In order to support strong typing of references to objects, a class or interface type can be used to specify a data type in a variable definition. The variable can then be used to hold an object reference, which is a value that references an instance of a class and its members. The object type name that defines the object reference can identify a class or an interface. If it identifies an interface, the object reference is used to point to an instance of a class that implements the specified interface. This interface can be an interface type that the class instance explicitly implements or a super interface inherited by the explicitly implemented interface.
Note: An object reference never points to an instance of an interface, because an interface is not an object itself, but is only used for defining a class and for referencing an instance of a class that implements the interface definition.
The object type name for a class or interface consists of two parts—a class or interface name preceded by a qualifying package name, for example, Classes.Inventory.MyClass. The package name corresponds to a directory path (related to PROPATH) where the class file that defines the class or interface type is stored, and the class or interface name is identical to the class filename. In a supported context, you can reference an object type without its qualifying package name. For more information, see Specifying unqualified class or interface type names. For more information on class or interface type names, see Defining and referencing object type names.
An object reference is comparable to the HANDLE data type, with the important distinction that an object reference identifies a specific object type that a variable or field defined for that object reference can hold. This allows the compiler to verify that all uses of the object reference are correct, which is not possible with a weakly typed handle.
In addition to a variable, you can define the following ABL elements to hold an object reference to a class or interface data type:
A property or the return type of a method or user-defined function
A parameter to a method, local procedure, or user-defined function
A field in a temp-table, which must always be defined as the root class type, Progress.Lang.Object
Note: You cannot define a database field as an object reference.
You can pass an object reference as a parameter between an AppServer and an ABL client, as long as the object’s class satisfies certain restrictions and the class is defined on boh the client and server sides. See OpenEdge Application Server: Developing AppServer Applications for more information.
You never use an object reference to access static members of a class. Instead, you can use a class type name to access the static members of a class. For more information, see Accessingstatic members.