我想在python中運行時動態創建類。 例如,我想複製代碼如下: >>> class RefObj(object):
... def __init__(self, ParentClassName):
... print "Created RefObj with ties to %s" % ParentClassName
... class Foo1(object):
... ref
我的班級是這樣的: class X {}
class Y extends X {};
class Z extends X {};
我對每個子類(ID +類)枚舉: enum Type {
Y_TYPE(1, Y.class), Z_TYPE(2, Z.class);
int id;
Class c;
public Type(int id, Class