1

In c#, when a child class is stored as the parent, but still constructed as the child. Will typeOf return the child type or the parent type?

Given the situation above here is an example case.

Parent c = new Child();
if(typeOf(c) == Child)
    Console.Print("c is stored as a Child");
else if(typeOf(c) == Parent)
    Console.Print("c is stored as a Parent");

And if typeOf will not give me the child type, how do I get the child type?

Aceroy
  • 11
  • 1

0 Answers0