Change class type at runtime
<p>I have two classes (let's call them <code>A</code> and <code>B</code>), both inheriting from a common superclass (<code>C</code>).</p>

<p>Let's say I need to build a <code>List</code> of <code>C</code>s. My problem is that, depending on the data received by <code>C</code>'s constructor I need to put an <code>A</code> or <code>B</code> object inside the list.</p>

<p>Is there a way to do this from inside <code>C</code>'s constructor? Or, alternatively, how can I solve this issue?</p>
