Try OpenEdge Now
skip to main content
ABL Reference
ABL Syntax Reference : Class-based object reference
 

Class-based object reference

References an instance of an ABL or .NET class and provides access to instance class members (per the restrictions of the access levels assigned to the members).

Syntax

object-reference [ [ key ] ] [ : {  data-member
                                     | property
                                      | method
                                  }
                              ]
object-reference
Specifies a reference to an instance of a class (an object). This can be a variable (data member), property, data member or property array element, handle attribute (such as FIRST-OBJECT), method return value, ABL function return, or user-defined function return value defined for an ABL or .NET object type. It also can be an appropriately-used system reference, such as SUPER or THIS-OBJECT. Its value references an instance of a specified class (class-based object). If it is for a class, the data type of the value can be for the class type itself or for a super class of the referenced class. If it is for an interface, its value can reference an instance of any class that implements that interface.
[ key ]
Specifies an indexer for the default indexed property of a .NET class. The brackets are a required part of the syntax.
The key value is an index value of any supported .NET data type that identifies the property value you want to reference. If this value is an object reference, you can also use it to access any public instance data-member, property, or method on the .NET class instance that the property references. For more information, see the reference entry for a Class-based property access.
Note: ABL also allows you to access the default indexed property of a class by specifying the indexer on the default property name. There is no functional difference between specifying the indexer directly on the object reference and specifying it on the property name. For more information on accessing .NET indexed properties, see the Class-based property access reference entry.
data-member
Specifies the name of a PUBLIC instance variable defined in the specified ABL class or of a public instance field defined in the specified .NET class. The value of the ABL variable data member can be written or read for the class instance referenced by object-reference. The value of a .NET field can be read or written for the class instance specified by object-reference, unless it is defined as a constant (using the C# const keyword). If it is a constant, it can only be read. For more information, see the reference entry for a Class-based data member access.
property
Specifies the name of a PUBLIC instance property defined in the specified ABL or .NET class. The value of this property can be written or read for the class instance referenced by object-reference, depending on the property definition. For more information, see the reference entry for a Class-based property access.
method
Specifies the name and any run-time parameters taken by a PUBLIC instance method defined in the specified ABL or .NET class, or a call to a built-in event method. A class method can provide a value, depending on the method definition. For more information on calling class methods, see the reference entry for a Class-based method call. For more information on the built-in event methods, see the Class Events Reference.

Notes

*You can obtain an object reference for a .NET object in the same way you can obtain a reference to any ABL class-based object, by creating a new object or obtaining the reference to an existing one. You cannot create or reference instances of the following .NET classes:
*Classes defined in the .NET default namespace (that is, classes with no namespace defined)
*System.Threading.Thread or any class derived from it
*System.Delegate or any delegate type derived from it
*If the documentation for a .NET class includes a member in a list of "Explicit Interface Implementations", you cannot access that member on an object reference defined as the class type. You can only access that member on an object reference that is defined as (or cast to) a particular interface that defines the method. Thus, ABL documentation refers to such a .NET class member as an explicit interface member.
*You cannot define or otherwise obtain an object reference to a .NET mapped object type (for example, System.Int32), except when overriding a .NET method or when implementing a method or property of a .NET interface. You can only access instances of .NET mapped object types as corresponding ABL primitive types (for example, INTEGER). For more information, see the Data types reference entry. However, you can access .NET static properties and methods on their defining .NET mapped object types.
*ABL classes do not currently support default or indexed properties. So, you cannot reference an ABL class instance using an indexer for a default indexed property.

See also

Class-based data member access, Class-based method call, Class-based property access, CLASS statement, FIRST-OBJECT attribute, LAST-OBJECT attribute, NEW function (classes), SUPER system reference, THIS-OBJECT system reference