Try OpenEdge Now
skip to main content
Object-oriented Programming
Programming with Class-based and Procedure Objects : Class-based and procedure object compatibility
 

Class-based and procedure object compatibility

ABL allows class-based objects and procedures to co-exist and work together to form a complete application. This section describes the features and limitations of mixing class-based objects and persistent procedures.
Each class defines a unique data type (object type). You must therefore use the syntax described in this manual to instantiate a class-based object of a specified type and execute its methods. You can use this syntax to instantiate a class within a procedure as well as within another class. In other words, a procedure can use the NEW function to create an instance of class, work with it, and delete it when it is no longer needed. The procedure can pass a reference to the object as a parameter in any procedure or user-defined function call. In addition, a user-defined function can define its return value to be an object reference. Classes and class-based objects are just another development tool that you have at your disposal.
From the opposite perspective, a method in a class can run a procedure using the same procedure-based syntax for running internal procedures within external procedures. A class can run a procedure persistently and save a handle to it just as another procedure can do. The class can run internal procedures and user-defined functions using that handle. It can delete the procedure when it is no longer needed. A method in the class can pass a procedure handle as a parameter or use it as a return value.
In summary, the restrictions that apply to classes and procedures apply to a limited set of definitional statements that are used in one or the other, not to the way in which they can interact with each other.
* Compatibility rules
* Invalid ABL within a user-defined class
* Verifying the source for an r-code file at run time