Try OpenEdge Now
skip to main content
Object-oriented Programming
Designing Objects: Inheritance, Polymorphism, and Delegation : Class hierarchies and inheritance : Data member and property scoping within a class hierarchy
 

Data member and property scoping within a class hierarchy

Classes support the same definitions for variables, buffers, queries, temp-tables, and ProDataSets as procedures do, with one difference. That difference is in the access mode PRIVATE, PUBLIC, or PROTECTED. Because of this difference, these built-in data types are referred to as data members when instances are defined for use at the class block level. For more information on what access modes are valid for each type of data member definition, see Defining data members within a class. By default, all data members are PRIVATE.
Properties provide another means to define instances of certain data types for use at the class block level. Properties use the same access modes as data members. However, because properties are typically used to encapsulate access to class data from outside the class hierarchy, the default access mode for properties is PUBLIC.
As with methods, the PROTECTED access mode defines data members and properties that are accessible throughout the class hierarchy but not from outside it, and the PRIVATE access mode defines data members and properties that are accessible only from within the defining class.
Note that an instance can access a PROTECTED data member or property of a second instance that is at the same level or in a super class in the class hierarchy, and an instance can access a PRIVATE data member or property of another instance if both are the same class.
* Comparison with procedure-based programming