I am new to c++ and i have a question.
Lets say we have a base class Base and two derived classes, Derived1 and Derived2.
f.e. Derived1 has a constructor taking a integer and Derived2 a constructor taking a boolean.
Is it possible to determine at run time (or at compile time) which of those two subclasses to create and assign it to the Base class.
Something like this:
Base b = ???(value), where value is of type integer or boolean.
Thanks in advance!
You probably want Factory Design Pattern.