PROTECTED SECTION

From Abap2Java

Jump to: navigation, search

ABAP

In the definition of a class, the keyword Protected Section indicates that all following methods, constructors and attributes are protected (which means visible only inside the current class or in subclasses).

CLASS CL_MY_CLASS DEFINITION.
  PUBLIC SECTION.
    "...

  PROTECTED SECTION.
    "protected attribute:
    DATA mv_1 TYPE I.

    "protected method:
    METHODS do_this IMPORTING iv_p TYPE I.

  PRIVATE SECTION.
     "...
ENDCLASS. 

See also:
Object Orientation, modifier, visibility

Java

Each method, constructor, and attribute can be defined separately as protected using the modifier protected.

Personal tools