class First
{
~First()
{
Console.WriteLine("First's destructor is called.");
}
}
class Second : First
{
~Second()
{
Console.WriteLine("Second's destructor is called.");
}
}
class Third : Second
{
~Third()
{
Console.WriteLine("Third's destructor is called.");
}
}
class TestDestructors
{
static void Main()
{
Third t = new Third();
}
}
/* Output :
Third's destructor is called.
Second's destructor is called.
First's destructor is called.
*/