Define an object reference variable or property
- Last Updated: May 18, 2021
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
This is the simplified syntax to define an
object reference variable using the
VAR
statement:
|
This is the syntax to define an object reference variable using the
DEFINE VARIABLE statement:
|
This is the simplified syntax to define an object reference property:
|
For the complete syntax, see the DEFINE PROPERTY statement.
Element descriptions for this syntax diagram follow:
Note: For more information on each option, see the specified references in this book
and also the
DEFINE VARIABLE, VAR, and DEFINE PROPERTY statement reference
entries in ABL Reference. For variables, no other options
apply, because they are not supported for object references.- access-mode
- The optional access mode specifies where and how the variable or property can be accessed, and the available options depend on where the variable is defined (as a class data member or property, within a procedure, etc.). For more information on accessing class data members and properties, see Access data members and properties.
- object-reference
- The name of a variable or property that will hold an object reference value.
- CLASS
- The
CLASSkeyword is required if object-type-name conflicts with an abbreviation for a built in ABL data type, such asINTE(INTEGER). Otherwise, it can optionally be used to clarify the readability of the statement. - object-type-name
- The type name of a class or interface. This can be the fully qualified
object type name or the unqualified class or interface name, depending on the presence
of an appropriate
USINGstatement in the class or procedure file. For more information on object type names, see Define and reference object type names. For more information on theUSINGstatement, see Reference an object type name without its package. - EXTENT constant
- An object type name defined with an extent is an array of object references to that type. In other words, each element of the array can contain an object reference to an instance of the specified type. If constant is zero, then the object reference is not an array.
- NO-UNDO
- If specified, prevents the variable or property value from being undone if a transaction that changes it is rolled back.
- accessor-definitions
- One or two property accessors that indicate if the property is readable, writable, or both.
For more information on defining:
- Variables as data members, see Define data members within a class
- Properties, see Define properties within a class
The following example shows a fragment of the Main class from the sample classes that are fully implemented in Sample classes. This fragment defines several private variables to hold object
references and filenames:
|