Try OpenEdge Now
skip to main content
Object-oriented Programming
Getting Started with Classes, Interfaces, and Objects : Using the CLASS construct : Defining the class destructor : Comparison with procedure-based programming
 
Comparison with procedure-based programming
With persistent procedures, the application must adhere to an enforced programming strategy in order to allow cleanup when the procedure exits. Typically, you do this by defining a trigger block to be executed ON CLOSE OF THIS-PROCEDURE, then take care to always delete a persistent procedure instance using the APPLY "CLOSE" statement rather than using the DELETE OBJECT statement. (This is the convention used in procedures generated by the AppBuilder.)
A destructor provides a uniform mechanism to handle such cleanup tasks in class-based objects without the need for special programming strategies.