PRIVATE SECTION
Syntax
PRIVATE SECTION.
Effect
This statement is only possible in the declaration section of a class and defines the private
visibility section of the class
class. All the components of the class that are declared
in the section after the PRIVATE SECTION statement can only be addressed in the class itself.
Notes
-
The smallest encapsulation unit in ABAP objects is the class. This is the reason why a method can use
not only the private components of its own class but also all private components of all instances of
the same class. The exception to this rule are subclasses that cannot access the private components of superior classes unless they are their friends.
-
The declaration of attributes in the private section does not prevent methods of the class from transferring
references to these attributes in the form of
reference variables or
field symbols, so that the attributes become visible and changeable outside the protected section.
-
Private components that are declared, but not statically used in a class trigger a warning in the extended program check.
Example
See Visibility Areas.