Académique Documents
Professionnel Documents
Culture Documents
6.10/6.20
1) Definition
2) Implementation
Components :
* Attributes
* Methods
* Events
Attributes :
a) Instance attributes
DATA : <attributename> TYPE <data type>
b) Static attributes
CLASS-DATA : <attribute name> TYPE <datatype>
Method are defined in two ways
a) Instance methods
Methods : <method name> Importing <p>
exporting <p>
changing <p>
exceptions <e1> <e2>..
b) Static Methods
CLASS-METHODS <method name> Importing <p>
exporting <p>
changing <p>
exceptions <e1> <e2>..
ENDCLASS.
1) Declare a reference variable
DATA : <REFVAR> TYPE REF TO <CLASS/INTERFACE>.
2) Create an Object
CREATE OBJECT <REFVAR>.
3) Access attribute.
Instance attribute
<REFVAR>-><attribute>.
Static attribute
<REFVAR>-><attribute>
<CLASSNAME>=><attribute>
4) Access Method
Instance method
<REFVAR>-><method name>
Static method
<REFVAR>-><method name>
<CLASSNAME>=><method name>
* Method Declaration
CLASS CL_DEMO DEFINITION.
PUBLIC SECTION.
METHODS : <method name> importing <p1>....
exporting <p2>....
Changing <c1>.....
exceptions <e1>....
ENDCLASS.
* Method Implementation
CLASS CL_DEMO IMPLEMENTATION.
METHOD <method name>
<statements>
ENDMETHOD.
ENDCLASS.
* Static Method Declaration
CLASS CL_DEMO DEFINITION.
PUBLIC SECTION.
CLASS-METHODS : <method name> importing <p1>....
exporting <p2>....
Changing <c1>.....
exceptions <e1>....
ENDCLASS.
* Static Method Implementation
CLASS CL_DEMO IMPLEMENTATION.
METHOD <method name>
<statements>
ENDMETHOD.
ENDCLASS.