Base destructor : destructor « Class « C# / CSharp Tutorial






using System;

public class Base
{
   ~Base()
   {
      Console.WriteLine( "Base.~Base()" );
   }
}

public class Derived : Base
{
   ~Derived()
   {
      Console.WriteLine( "Derived.~Derived()" );
   }
}

public class MainClass
{
   static void Main()
   {
      Derived derived = new Derived();
   }
}
Derived.~Derived()
Base.~Base()








7.14.destructor
7.14.1.Destructors
7.14.2.Simple Finalize
7.14.3.Illustrates a destructor
7.14.4.Demonstrate a destructor.
7.14.5.Use destructor and implement IDisposable
7.14.6.Base destructor
7.14.7.Update static field in the deconstructor