Google Search - Blog...........

ABAP - OOPS: Constructors Of Superclass Flows Down The Chain In Method Programming.

REPORT YSUBOOPS18.

CLASS C1 DEFINITION.
PUBLIC SECTION.
METHODS : CONSTRUCTOR .
ENDCLASS.

CLASS C1 IMPLEMENTATION.

METHOD constructor.
WRITE:/5 'I am C1'.
skip.
ENDMETHOD.
ENDCLASS.

CLASS C2 DEFINITION INHERITING FROM C1.
ENDCLASS.

CLASS C2 IMPLEMENTATION.
ENDCLASS.


START-OF-SELECTION.
DATA: obj type ref to C2.
CREATE OBJECT: obj.

Output I am C1.

No comments:

Post a Comment