For example, I have three classes: Animal
, Dog
and Cat
; where Animal
is an abstract class and inherits its properties to Dog
and Cat
. Say on my program, I have an arbitrary list of things that the user may input (I'm doing this on C# Form). So I store all the inputs, whether they are of class Cat
or Dog
, into my List<Animal>
.
Now I would like to retrieve said instantiated class from List<Animal>
and retrieve its original class, whether it's a Cat
or a Dog
. Is there a way to do that?