Hello. When I create an object of the inherited class. for example
using System; class A { public virtual void foo() { Console.WriteLine("this is virtual function"); } public void func() { Console.WriteLine("first function"); } } class B : A { public override void foo() { Console.WriteLine("this is override function"); } public void func2() { Console.WriteLine("second function"); } } class Program { static void Main() { A obj; B obj2 = new B(); obj = obj2; obj.foo(); Console.ReadKey(); } } and create an object of class B and assign it to obj = obj2, then an incomprehensible case arises. That is, I can only call functions (fields) of class A, but one exception is that I can call the function public override void foo () from class B. How is it possible that obj does not see the arguments of class B, but sees the overridden methods?