Why base class = new derived class cannot call derived class method? C# : I have some question which get me confused, I hope finally I can found answer here :)
So.

we have two classes A and B, B Derives from A,
I created of A a = new B();
Why in my code when I call method of B that does not contain A I get error.
Does it mean that Type Objec Pointer is of type A? and second why When I call SomeMethod it calls method of A not B?

In the heap in this situation when created object instance, type object pointer points to A or B?

 


    class A
    {
        public void SomeMethod()
        {
            Console.Write("This is A");
        }
    }

    class B : A
    {
        public void SomeMethod()
        {
            Console.Write("This is B");
        }

        public void OtherMethod()
        {
            Console.Write("This is New method");
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            A a = new B();

            a.SomeMethod(); // This is A method
            a.OtherMethod(); // I get error here that a does not contain definition for this method

        }
    }



