C++ Type which hold class type
<p>In Free Pascal I can create class of class which create object from assigned class type. For example:</p>

<pre><code>type
  TBaseClass = class
  end;

  TBaseClassType = class of TBaseClass;

  TFooClass = class(TBaseClass)
  end;

  TBarClass = class(TBaseClass)
  end;
</code></pre>

<p>Now I can declare variable:</p>

<pre><code>MyClassType: TBaseClassType;
MyObject: TBaseClass;
</code></pre>

<p>And usage:</p>

<pre><code>// This will create instance of object TFooClass
MyClassType := TFooClass;
MyObject := MyClassType.Create;

// ... and here of TBarClass
MyClassType := TBarClass;
MyObject := MyClassType.Create;
</code></pre>

<p>How can I do something similar in C++? How to store class type in some var and create object from it (and call it constructor of course)</p>

<p>Regards</p>
