String classname="com.mo.ManagedObject";
classname=object;//object 是ManagedObject子类的全名
ManagedObject mmo=mo;
try
{
Class destClass=Class.forName(classname);
Constructor mo_ctor = destClass.getConstructor(ManagedObject.class);
mmo = (ManagedObject) mo_ctor.newInstance(mo);//子类的构造函数
}
catch(Exception e)
{
e.printStackTrace();
}
return mmo;
classname=object;//object 是ManagedObject子类的全名
ManagedObject mmo=mo;
try
{
Class destClass=Class.forName(classname);
Constructor mo_ctor = destClass.getConstructor(ManagedObject.class);
mmo = (ManagedObject) mo_ctor.newInstance(mo);//子类的构造函数
}
catch(Exception e)
{
e.printStackTrace();
}
return mmo;