restored Object.factory()

This commit is contained in:
Walter Bright 2008-10-12 20:03:44 +00:00
parent 844127aa90
commit eb91542f26

View file

@ -125,6 +125,23 @@ class Object
void lock();
void unlock();
}
/******
* Create instance of class specified by classname.
* The class must either have no constructors or have
* a default constructor.
* Returns:
* null if failed
*/
static Object factory(string classname)
{
auto ci = ClassInfo.find(classname);
if (ci)
{
return ci.create();
}
return null;
}
}
/**