CLASS - IMPLEMENTATION

Syntax

CLASS class IMPLEMENTATION.
  ...
  METHOD ...
    ...
  ENDMETHOD.
  ...
ENDCLASS.

Effect

The following methods of the class class must be implemented, in any order, in the statement block CLASS class IMPLEMENTATION - ENDCLASS :

All concrete methods that have been listed in the declaration part of the class using the METHODS or CLASS-METHODS statements

All concrete methods of interfaces that have been listed in the declaration part of the class using the INTERFACES statement

All methods inherited from superclasses that have been listed in the declaration part of the class using the METHODS ... REDEFINITION statement.

The implementation of each method corresponds to a METHOD - ENDMETHOD processing block. No statements are allowed in the implementation part apart from the method implementations. All components of the class can be accessed in an instance method implementation. All static components of the class can be accessed in a static method implementation. You do not need a component selector to address the component of the method's own class. An implicit generated local reference variable is available at runtime within the implementation of each instance method. It points to the current instance of the method.

Notes

Abstract methods in abstract classes cannot be implemented in the implementation part.

Example

In this example, three methods of the class c2 must be implemented. Conversely, the method m1 in c1 is abstract and cannot be implemented here.

INTERFACE i1.
  METHODS m1.
ENDINTERFACE.

CLASS c1 DEFINITION ABSTRACT.
  PROTECTED SECTION.
    METHODS m1 ABSTRACT.
ENDCLASS.

CLASS c2 DEFINITION INHERITING FROM c1.
  PUBLIC SECTION.
    INTERFACES i1.
    METHODS m2.
  PROTECTED SECTION.
    METHODS m1 REDEFINITION.
ENDCLASS.

CLASS c2 IMPLEMENTATION.
  METHOD m1.
    ...
  ENDMETHOD.
  METHOD m2.
    ...
  ENDMETHOD.
  METHOD i1~m1.
    ...
  ENDMETHOD.
ENDCLASS.