Try OpenEdge Now
skip to main content
Object-oriented Programming
Programming with Class-based Objects : Instantiating and managing class-based objects : Defining an object reference parameter
 

Defining an object reference parameter

Procedures, user-defined functions, and class-based methods can all define object reference parameters (as class or interface types). When an object is passed locally, class instances are passed by reference using object references. Thus, only a reference to an object is passed, not the object itself. When an object is passed between an AppServer and an ABL client, the object is serialized by the sender, and the receiver uses this information to create a copy of the object.
Note: To pass an object reference parameter between an AppServer and an ABL client, the object’s class must be defined on both the client and AppServer, and the class must be marked as serializable. For a full list of the restrictions on passable classes, see Passing object reference parameters.
This is the syntax to define an object reference parameter for a method in a class or a user-defined function in a procedure:

Syntax

[ INPUT | INPUT-OUTPUT | OUTPUT ]parameter-name
  AS [CLASS]object-type-name
This is the syntax to define an object reference parameter for a procedure:
DEFINE [ INPUT | INPUT-OUTPUT | OUTPUT ] PARAMETER parameter-name
  AS [CLASS]object-type-name] .
Descriptions of the object reference parameter syntax elements (bolded) follow:
parameter-name
The name of the parameter representing the object reference.
CLASS
The CLASS keyword is required if object-type-name conflicts with an abbreviation for a built in ABL data type, such as INTE (INTEGER). Otherwise, it can optionally be used to clarify the readability of the statement.
object-type-name
The class or interface type name of an object reference to be passed. This can be the fully qualified object type name or the unqualified class or interface name, depending on the presence of an appropriate USING statement in the class or procedure file. For more information on object type names, see Defining and referencing object type names. For more information on the USING statement, see Referencing an object type name without its package.
For more information on the full syntax for parameter definitions, see the DEFINE PARAMETER statement and Parameter definition syntax reference entries in OpenEdge Development: ABL Reference.