Data members and properties
- Last Updated: February 13, 2020
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
Data members and properties
You define data members and properties of a class in the main block of the
class, outside of any method definitions for the class. Class data members and properties have
an access mode that determines where and how you can access the data member or property.
PRIVATE data members or properties are accessible from
within the class where they are defined. An instance can access a PRIVATE data member or property of another instance if they are both instances of
the same class. PROTECTED data members or properties are
accessible from within the class where they are defined and in any subclass of the defining
class. PUBLIC data members or properties are accessible both
within the class hierarchy and from outside the class hierarchy where they are defined. To
fully encapsulate the data members of a class, you typically make each data member PRIVATE and access it indirectly through a PUBLIC property or PUBLIC method, as
appropriate.
You can define data members as a wide variety of ABL data elements, including
variables, temp-tables, ProDataSets, and other handle-based objects. Of these data members,
only variables can be PUBLIC. Variables and some other data
members can be defined as object references to other class-based objects that the class
instantiates. You can define a property as any data type that a method or user-defined
function can return as a value, including an object reference or ABL array.
You define data members and properties of a class in the main block of the
class, outside of any method definitions for the class. Class data members and properties
have an access mode that determines where and how you can access the data member or
property. PRIVATE data members or properties are accessible
from within the class where they are defined. An instance can access a PRIVATE data member or property of another instance if they are
both instances of the same class. PROTECTED data members or
properties are accessible from within the class where they are defined and in any subclass
of the defining class. PACKAGE-PRIVATE variable data members can be
accessed from within the class and any class within its package.
PACKAGE-PROTECTED variable data members can be accessed from within the
class, any class within its package, and from within any subclass that inherits the class.
PUBLIC data members or properties are accessible both
within the class hierarchy and from outside the class hierarchy where they are defined. To
fully encapsulate the data members of a class, you typically make each data member PRIVATE and access it indirectly through a PUBLIC property or PUBLIC
method, as appropriate.
You can define data members as a wide variety of ABL data elements,
including variables, temp-tables, ProDataSets, and other handle-based objects. Of these data
members, only variables can be PACKAGE-PRIVATE,
PACKAGE-PROTECTED, or PUBLIC. Variables
and some other data members can be defined as object references to other class-based objects
that the class instantiates. You can define a property as any data type that a method or
user-defined function can return as a value, including an object reference or ABL array.