title: C# Class Type conversion
body: <p>This is such a difficult question to explain online but I shall try my best. I have instantiated an object of type B which is stored in a variable of type A. I use the get type property, so now it is type B. Have I therefore performed an implicit conversion of type A and B. So therefore when a.show() is called is it of type B? </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace ConsoleApplication1
  {
  
      class A
      {
          public virtual void show()
          {
              Console.WriteLine("Showing A");
          }
  
          public void test()
          {
              Console.WriteLine("called from A");
          }
      }
  
      class B:A
      {
          public override void show()
  
          {
              Console.WriteLine("Showing B");
          }
  
          public void testb()
          {
              Console.WriteLine("called from B");
          }
      }
      class Program
      {
          static void Main(string[] args)
          {
  
  
              A a = new B();
              // Outputs ConsoleApplication.B
              Console.WriteLine("{0}", a.GetType());
              // outputs showing B
              a.show();
              // outputs called from A
              a.test();
  
              Console.ReadLine();
          }
      }
  }
  </code></pre>