class Program
{
static void Main(string[] args)
{
Three t = new Three();
Console.ReadLine();
}
}
class One
{
//Constructor
public One()
{
Console.WriteLine("First Constructor Called");
}
//Destructor
~One()
{
Console.WriteLine("First destructor is called.");
Console.ReadLine();
}
}
class Two : One
{
//Constructor
public Two()
{
Console.WriteLine("Second Constructor Called");
}
//Destructor
~Two()
{
Console.WriteLine("Second destructor is called.");
}
}
class Three : Two
{
//Constructor
public Three()
{
Console.WriteLine("Third Constructor Called");
}
//Destructor
~Three()
{
Console.WriteLine("Third destructor is called.");
}
}
/*The result of this Program will be:-
First Constructor Called
Second Constructor Called
Third Constructor Called
Third destructor is called.
Second destructor is called.
First destructor is called.
*/