No. But to elegantly get around this limitation, I would list all the possible classes and create an array of the corresponding class names:
enum ECLASSTYPE { CT_WATER_SCENE, CT_SOME_OTHER, CT__MAX, }; static const string g_classNames[CT__MAX] = { "WaterScene",
When parsing xml, decode the name of the string to enumerate and pass it to the factory method:
switch (classType) { case CT_WATER_SCENE: { result = new WaterScene(); break; } ... }
source share