Try OpenEdge Now
skip to main content
Object-oriented Programming
Object-oriented Programming and ABL : Overview of class-based ABL : Accessing data members and properties
 

Accessing data members and properties

You can access an accessible data member or property from within a class that defines or inherits it simply by naming it, for example, ItemCount. A data member can appear wherever its data type is allowed. A property can appear wherever its data type and accessor definitions allow. If the property is readable, it can appear wherever an expression of the specified data type is allowed. If the property is writable, it can appear wherever the specified data type can be written.
You can access a PUBLIC data member or property that is defined in another class instance (outside the running class hierarchy) in a similar fashion, except that you must prefix the data member or property name with an object reference to the other class instance separated by a colon (:), for example, rInventory:ItemCount. Accessing a data member or property on (defined in) another object is analogous to accessing a built-in attribute on an ABL handle-based object, for example, ERROR-STATUS:NUM-MESSAGES.
You can also access a class property dynamically using the DYNAMIC-PROPERTY function. This is initiated with the help of GetPropertyValue( ) and SetPropertyValue( ) methods that make it possible to get or set a property’s value without knowing the type of the property’s name at compile time,
For more information on accessing a class property dynamically, see Dynamically accessing a property at runtime.
Outside of the class hierarchy where it is defined, you must access a PUBLIC static data member or property by prefixing the member name with the class type rather than an object reference. For more information on static data members and properties, see Usingstatic members of a class.
For more information on accessing data members and properties, see Accessing data members and properties.
* Comparison with procedure-based programming