Note: Finalizers (like Constructors and Custom Operators) are very similar in structure to regular methods, and many topics covered in the Methods topic will apply to them as well, in particular the section on Method Body.
Similar to Constructors, Oxygene uses a special
finalizer keyword to declare finalizers. Finalizers are always considered
private, and they cannot be called explicitly from code, they will only be called implicitly, by the runtime. Finalizers cannot have parameters or a return type.
type MyClass = public class finalizer; begin ... end; end;
Finalizers do not directly participate in Virtuality Modifiers. If a base class implements a finalizer, the compiler will automatically make sure finalizers in descendant classes will safely call the base finalizer as last step of their execution., and cannot have
No modifiers are allowed on finalizers.