Virtual Constructor Help Needed.
Okeydokey, im up to no good again. What im trying to do is this:
I have the core class called Core.
I have a base class called Module.
Somebody else will create derived classes, whatever they may be.
Core contains a std::map<string,Module*> Modules.
Core has a member function called AddModule(std::string modname)
What i need to do is have Core.AddModule("DerivedClass1"); and it will do something along the lines of
Code:
if(!Modules[modname]) { Modules[modname] = new modname; }
Im told what i want is called a Virtual Constructor, however after googling im not sure that does what i need. Very hard to find source code that does anything like this, so any help or examples would be greatly appreciated.
As always, thanks for your time.