Bit of a noobie question but hey ho.
Example:
BaseClass bc = new ExtendedClass(); //Assume ExtendedClass inherits from BaseClass
((BaseClass)bc).ExtendedMethod();
bc.ExtendedMethod();
((ExtendedClass)bc).ExtendedMethod(); //overridden in ExtendedClass
ExtendedClass ec = new ExtendedClass();
((BaseClass)ec).ExtendedMethod();
ec.ExtendedMethod();
((ExtendedClass)ec).ExtendedMethod(); //overridden in ExtendedClass
?
What implementations will bc.ExtendedMethod();
and ec.ExtendedMethod();
call at runtime? Will they be different? I assume the casted calls will call the specific implementation within the class.
edit: added relevant tag.