Release 10.1A: OpenEdge Getting Started:
Object-oriented Programming

> ## Compatibility rules

> Since an object reference and a procedure handle represent two very different constructs in Progress, the following rules apply when working with both:

> - You cannot run r-code for a class using the `RUN` statement. You must use the `NEW` statement to create a class instance.

> - You can only use the `NEW` statement to create an instance of a class. You cannot use the `NEW` statement to run a persistent procedure.

> - An instance of a class never has a procedure object handle associated with it. Thus, a class does not use system handles, such as `THIS-PROCEDURE` or `TARGET-PROCEDURE`, that return procedure object handles for referencing the r-code of a referencing procedure. Using any of these keywords in a class results in a compile-time error.

> - A procedure has no notion of a class or object reference. Thus a procedure cannot use keywords, such as `THIS-OBJECT`, that return references to the r-code of a referencing class or class hierarchy. Using any of these keywords in a procedure results in a compile-time error.

> - You cannot assign a procedure handle to an object reference. You cannot assign an object reference to a procedure handle. Thus, while you can cast object references from one to another, you cannot cast an object reference to a procedure handle or in any way convert one to the other.

> - You cannot pass an object reference to a routine expecting a procedure handle. Likewise, you cannot pass a procedure handle to a routine expecting an object reference. As noted, there is no way to cast a procedure handle to an object reference or an object reference to a procedure handle.

> - You cannot define methods in a procedure. Procedures define their internal entry points as internal procedures or user-defined functions only. You can define methods only in classes. Likewise, you cannot define internal procedure or user-defined functions in procedures, but only in external procedures.

> - You cannot use the `object-reference`:`method-name` syntax to run an internal procedure or a function, but only a method. You can use this syntax, however, in both classes and procedures.

> - You cannot define a constructor or destructor for a procedure. You can define these special methods only for classes.

> - You cannot use a `PUBLIC`, `PRIVATE`, or `PROTECTED` access modifier on a variable or other data member definition except in the main block of a class.

> - You cannot use the 4GL built-in `ADD-SUPER-PROCEDURE( )` method on the `THIS-OBJECT` system reference or the `THIS-PROCEDURE` system handle within a class or otherwise use the super procedure mechanism to create a hierarchy of object references. Thus, you cannot add a class-based object as a super procedure. However within a class, you can use the `SESSION:ADD-SUPER-PROCEDURE( )` method to extend the super procedure chain of the `SESSION` handle, and you can use the `procedure-handle``:ADD-SUPER-PROCEDURE( )` method, where `procedure-handle` is a procedure object handle set from running a persistent procedure, in order to extend the super procedure chain for other, procedure-based objects.

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