Try OpenEdge Now
skip to main content
Guide for New Developers
An overview of ABL : Understanding the ABL Class-based model and its members : Destructor
 

Destructor

A destructor, which you can define as needed and which is automatically invoked during garbage collection or when you delete it by garbage collection, by a DELETE OBJECT statement, or halting a class instantiation by a RETURN ERROR or UNDO, THROW. Thus, you never call a destructor directly. You can provide a destructor when the class needs to free resources or do other cleanup work when a class instance is destroyed. If a destructor is not provided, ABL provides a default destructor in order to delete the object.
Unlike ordinary methods, a destructor definition is identified by the DESTRUCTOR statement. Destructors have no return type, are always PUBLIC, and cannot have any parameters. Destructors also are instance members. Note that there is no static destructor.
A class is not required to have a destructor. If a class has not defined a destructor for the class, ABL provides a default destructor for the class.
For each class instance that you delete, its destructor is responsible for deleting any resources allocated during the execution of that class instance. Deleting the class instance automatically deletes all dynamic handle-based objects that are created in any default unnamed widget pool that is specified for the class.
For more information on Object-oriented programming, see the guide OpenEdge Development: Object-oriented Programming.