The Freya Programming Language

Destructors

See also

Destructors are special methods that contain actions to be executed when an instance of a class is no longer used.

Destructors as finalizers

Destructors in Freya, however, are very different from destructors from traditional languages like C++ or Delphi. The main difference is that Freya, as almost all .NET languages, is based on a system-implemented garbage collector.

destructor;
local-variablesopt
begin
    statements
end;

Destructors can only be declared and implemented in the implementation section of the class, and since they have no parameters, they cannot be overloaded.

The destructor from the base class is automatically called after any statements in a local defined destructor.

See also

The Freya Programming Language
Type declarations
Type members
Constructors
Methods
User defined operators
Fields
Properties
Indexers
Events
Instantiation