Is it possible at all to control the creation of different classes from configurations?
Say, I have a function which does this which is hard-coded:
BaseClass* getClassObject(int type)
{
switch (type)
{
case 1:
return new DerivedClass1();
case 2:
return new DerivedClass2();
default:
return 0;
}
}
Is it possible to transfer the control to some kind of data structure so that the user just needs to fill in the data structure to control how the function behaves?