Release 10.1A: OpenEdge Development:
Progress 4GL Reference

> ## DESTRUCTOR statement

> Defines a destructor method for a class. Progress invokes this destructor method when the object is deleted using the DELETE OBJECT statement.

> Note: This statement is applicable only when used in a class definition (`.cls`) file.

> #### Syntax

>     DESTRUCTOR PUBLIC class-name ( ):
>     destructor-body

> `PUBLIC`

> Specifies the access mode for this destructor method. The access mode for a destructor method is always PUBLIC.

> A PUBLIC destructor method can be accessed indirectly by the defining class, any of its inheriting classes, and any class or procedure that instantiates the class object (that is, through an object reference) by deleting the object instance using the DELETE OBJECT statement.

> ``class-name``

> The name of the class this method destroys. This name must match the class name portion of the type name for the class (that is, the name of the class definition file excluding the `.cls` extension and any package path information).

> ``destructor-body``

> The body of the destructor definition. Define the destructor body using the following syntax:

>            .
>            .
>            .
>     method-logic
>            .
>            .
>            .
>     END [ DESTRUCTOR ].

> ``method-logic``

> The logic of the destructor method, which can contain any Progress 4GL statements currently allowed within a PROCEDURE block including class-related statements, but excluding the RETURN ERROR statement. The method’s logic must not reference, either directly or indirectly, statements that block I/O (namely, the CHOOSE, INSERT, PROMPT-FOR, READKEY, SET, UPDATE, and WAIT-FOR statements).

> This method typically contains logic to release system resources used by the class object instance.

> `END [ DESTRUCTOR ]`

> Specifies the end of the destructor body definition. You must end the destructor body definition with the END statement.

> Example

> The following example shows the definition of a destructor method:

>     DESTRUCTOR PUBLIC CustObj( ):
>       EMPTY TEMP-TABLE ttCust.
>     END DESTRUCTOR.

> #### Notes

> - You can terminate a DESTRUCTOR statement with either a period (.) or a colon (:).

> - A complete destructor method definition must begin with the DESTRUCTOR statement and end with the END statement.

> - A destructor method has no parameters and no return value.

> - You never explicitly invoke the destructor method to delete a class object instance. The method is implicitly invoked when the object instance is destroyed by the DELETE OBJECT statement.

> #### See also

> CLASS statement, CONSTRUCTOR statement, DELETE OBJECT statement

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095