Polymorphism and c#

c#, polymorphism

Solution

B.Method1();

gets called because it properly overrides the virtual method `A.Method1();`

Problem

Here one more basic question asked in MS interview recently ``` class A { public virtual void Method1(){} public void Method2() { Method1(); } } class B:A { public override void Method1() { } } class main { A obk = new B(); obk.Method2(); } ``` So which function gets called? Sorry for the typos.

Original source