I need some pretty approach to load polymorhic object
I have base class and several derived classes that base is not aware of. The only thing base class knows is Type enum wich defines which actual class it is.
class Order
{
OrderType Type;
bool Load(string filename)
{
// load Type
}
}
class LimitOrder : Order
{
// some data
bool Load(string filename)
{
// load some data
}
}
I need to write a Load method for base class Order that would correctly create respective derived class. I am looking for a good pattern.