Dynamically pass the type name to a static_cast
<p>Is it possible to dynamically choose the type you wish to cast to, during runtime?</p>

<p>For example, suppose I have:</p>

<p><code>ClassType * pointer=static_cast&lt;ClassType*&gt;(baseClassPointer);</code></p>

<p>At run time, however, I'd like to choose what the <code>ClassType</code> is, rather than having to hardcode it into the function.</p>

<p>Is this possible? The two ways I'm thinking I'd want to use it is either passing an actual <code>char *</code> that contains the name of the type I want to use, or somehow extracting the type information from an existing class and using that as the cast.</p>

<p>The reason I want to do this, is I have several derived classes from a common base class. I can get the basic functionality of the base class for each of the derived classes, but if I want a pointer to access some of the specific functionality that only exists in the derived class, I need to cast that pointer as such. And I'd like to have a function that allows me to do this casting dynamically for any of the derived classes.</p>
