In the following program instead of giving the type of the object, output gives the name of the constructor. Please explain the
reason for this.
using System;
class A
{
}
class B : A
{
}
class C : B
{
}
class Program
{
static void Main()
{
A a1 = new A();
A a2 = new B();
A a3 = new C();
Console.WriteLine(a1.GetType());
Console.WriteLine(a2.GetType());
Console.WriteLine(a3.GetType());
Console.ReadKey();
}
}
/*
A
B
C
*/