You create an instance of B that is lets say “Bigger”, but the variable ‘a’ is converted into class A that is “Smaller” and contains the method print A. You did something similar to:
A : IClass
B : IClass
The interface exposes some method that is in both A and B, and you to trigger it, use:
(IClass)A.Print
(IClass)B.Print
The same is here:
In simple words. B contains class A. So you with A a = new B(); Initiated the B class but in the same time extracted ( converted ) into A class.
1
solved Polymorphism in C#. Base Class’s Method is Called But Why? [duplicate]