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

Defining properties

Properties are class members similar to variable data members, but they can have behavior defined and associated with them. This behavior specifies if a property can be read or written, and includes any statements to be executed when the property is read or written. ABL allows you to define a property using a DEFINE PROPERTY statement, which includes the definition of any one or two special methods, each of which is referred to as an accessor. A GET accessor indicates that the property is readable and includes optional statements to be executed when the property is read. A SET accessor indicates that the property is writable and includes optional statements to be executed when the property is written. The data type of a property can be any data type allowed for the return type of a method. Each property has an access mode (PRIVATE, PROTECTED, or PUBLIC), which can be separately defined for one of the two specified accessors. By default, all properties are PUBLIC (unlike data members).
Within an abstract class, you can also define a property as ABSTRACT, which means that it must be overridden and implemented in a subclass. An abstract property is defined by its data type and accessor declarations, declared as a prototype without an initial value or any accessor code blocks. The first non-abstract derived class in the subclass hierarchy must override and implement the property as non-abstract (by defining any required initial value and accessor code blocks), unless an abstract class has already done so. An abstract property override can also specify a less restrictive access mode.
Note: Unlike methods, you can only override an inherited property that is defined as abstract.
ABL also supports static properties that are associated with a class type rather than a class instance. Unless otherwise specified, any reference to a property in this manual refers to an instance property. For more information on static class members, see Using static members of a class.
For information on the ABL to access properties, see Accessing data members and properties. For more information on defining properties, see Defining properties within a class. You can also define data elements known as a data members. For more information, see Defining data members.
* Comparison with procedure-based programming