I have two classes (let's call them `A` and `B`), both inheriting from a common superclass (`C`).

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

Is there a way to do this from inside `C`'s constructor? Or, alternatively, how can I solve this issue?