Register Login

OOP's Concept with program example

Updated May 18, 2018

OOP's Concept with program example


Public attributes

Public attributes are defined in the PUBLIC section and can be viewed and changed from outside the class. There is direct access to public attributes. As a general rule, as few public attributes should be defined as possible.

  DATA: Counter type i.


Private attributes

Private attributes are defined in the PRIVATE section. The can only be viewes and changed from within the class. There is no direct access from outside the class.

    DATA: name(25) TYPE c,
          planetype LIKE saplane-planetyp,

Instance attributes

There exist one instance attribute for each instance of the class, thus they exist seperately for each object. Instance attributes are declared with the DATA keyword.

Static attributes

Static attributes exist only once for each class. The data are the same for all instances of the class, and can be used e.g. for instance counters. Static attributes are defined with the keyword CLASS-DATA.

  CLASS-DATA: counter type i,    
PUBLIC Method:

Can called from outside the class

  METHODS:  set_attributes IMPORTING p_name(25) TYPE c,
                                                            p_planetype LIKE saplane-planetyp,


Can only be called from inside the class. They are placed in the PRIVATE section of the class.


 Download attached file.

You must be Logged in to download this file