title: c++: Dynamically choose which subclass to create
body: <p>I am new to c++ and i have a question.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>Something like this:
  Base b = ???(value), where value is of type integer or boolean.</p>
  
  <p>Thanks in advance!</p>