Try OpenEdge Now
skip to main content
Object-oriented Programming
Object-oriented Programming and ABL : Overview of object-oriented programming : Encapsulation : Comparison with procedure-based programming
 
Comparison with procedure-based programming
ABL procedures also provide a degree of encapsulation. By default, the variables and other data definitions of a procedure are private and cannot be accessed directly from other procedures. Procedures can use shared variables and other mechanisms to share data between them, which effectively breaks encapsulation. However, to effectively encapsulate its data, a procedure can define public internal procedures and user-defined functions to allow controlled access to this data. Procedures and user-defined functions are public, by default.
To fully encapsulate some of its behavior, a procedure can also define private internal procedures and user-defined functions that cannot be executed from another external procedure.
However the class-based mechanism for defining private, protected, and public methods, data members, and properties allows you to control encapsulation with far more precision and consistency than is possible with procedures.