If I instantiate an object like such :
Person hello = new Person();
I'm allowed to do something like
Employee test = (Employee)hello;
What does this do? What'd downcasting all about? So when we allocate memory for the base, and down cast what happens there?
It will not work. It will throw InvalidCastException
at runtime. (assuming Employee : Person
).