What is the difference between inheritance and creating and object
<p>I am looking for a answer which may very basic but still not in my mind. </p>

<p>What is the difference between Inheriting a class and instantiating a class ?</p>

<p>For example in below example i have a class named "A" and class "B". B inherits A to get public members of A, I understand. But if this is only to access functions of Class "A" from Class "B", This can also be achieved by instantiation of class "A" in Class "B". </p>

<p>Can anybody help me to get answer of this question ?</p>

<pre><code>// Accessing function of A in B using Inheritance
       using System;

    public class A
    {
        public void Show()
        {

            Console.WriteLine("Show from a");
        }

    }


    public class B : A
    {

        public static void Main()
        {
            B b = new B();
            b.Show();
            Console.WriteLine("I am in B");

        }

    }

//Accessing class A method in class B by creating object of A in B

using System;

public class A
{
    public void Show()
    {

        Console.WriteLine("Show from a");
    }

}


public class B 
{

    public static void Main()
    {
        A a = new A();
        a.Show();
        Console.WriteLine("I am in B");

    }

}
</code></pre>

<p>I edited this program just to demonstrate both way of accessing method of class A in class B. Please advice what is the difference in between above two methods ?</p>
