Instantiation of class
<p>I am newbie in C#.I have one confusion. </p>

<p>There are two classes A and B.</p>

<pre><code>using System;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            A objA = new A();

            A objB = new B();
        }
    }

    class A
    {
        public void MethodA()
        {
            Console.WriteLine("method of A class");
        }
    }

    class B : A
    {
        public void MethodB()
        {
            Console.WriteLine("method of B class");
        }
    }
}
</code></pre>

<p>Now the confusion which I have is that what is the meaning of:</p>

<pre><code>A objB = new B();
</code></pre>

<p>I have seen and instantiated class like thi:</p>

<pre><code>A objB = new A();
</code></pre>

<p>Can anyone tell me why we used:</p>

<pre><code>A objB = new B();
</code></pre>

<p>Thanks in advance.</p>
