REPORT ZO_CLASS2.
*----------------------------------------------------------------------*
* CLASS CLASS1 DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS PARENT DEFINITION.
PUBLIC SECTION.
DATA: VAR1(30) TYPE C VALUE 'Parent Class Public'.
METHODS: MET1.
PROTECTED SECTION.
DATA: VAR2(330) TYPE C VALUE 'Parent Class Protected'.
PRIVATE SECTION.
DATA: VAR3(30) TYPE C VALUE 'Parent Class Private'.
ENDCLASS. "CLASS1 DEFINITION
*----------------------------------------------------------------------*
* CLASS CHILD DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS CHILD DEFINITION INHERITING FROM PARENT.
PUBLIC SECTION.
METHODS: MET2.
ENDCLASS. "CHILD DEFINITION
*----------------------------------------------------------------------*
* CLASS CLASS1 IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS PARENT IMPLEMENTATION.
METHOD MET1.
WRITE:/ VAR1, VAR2, VAR3.
ENDMETHOD. "MET1
ENDCLASS. "CLASS1 IMPLEMENTATION
*----------------------------------------------------------------------*
* CLASS CHILD IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS CHILD IMPLEMENTATION.
METHOD MET2.
WRITE:/ VAR1, VAR2.
ENDMETHOD. "MET2
ENDCLASS. "CHILD IMPLEMENTATION
START-OF-SELECTION.
DATA: OREF TYPE REF TO PARENT,
ORE1 TYPE REF TO CHILD.
CREATE OBJECT: OREF, ORE1.
CALL METHOD OREF->MET1.
CALL METHOD ORE1->MET2.
WRITE:/ OREF->VAR1.
*----------------------------------------------------------------------*
* CLASS CLASS1 DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS PARENT DEFINITION.
PUBLIC SECTION.
DATA: VAR1(30) TYPE C VALUE 'Parent Class Public'.
METHODS: MET1.
PROTECTED SECTION.
DATA: VAR2(330) TYPE C VALUE 'Parent Class Protected'.
PRIVATE SECTION.
DATA: VAR3(30) TYPE C VALUE 'Parent Class Private'.
ENDCLASS. "CLASS1 DEFINITION
*----------------------------------------------------------------------*
* CLASS CHILD DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS CHILD DEFINITION INHERITING FROM PARENT.
PUBLIC SECTION.
METHODS: MET2.
ENDCLASS. "CHILD DEFINITION
*----------------------------------------------------------------------*
* CLASS CLASS1 IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS PARENT IMPLEMENTATION.
METHOD MET1.
WRITE:/ VAR1, VAR2, VAR3.
ENDMETHOD. "MET1
ENDCLASS. "CLASS1 IMPLEMENTATION
*----------------------------------------------------------------------*
* CLASS CHILD IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS CHILD IMPLEMENTATION.
METHOD MET2.
WRITE:/ VAR1, VAR2.
ENDMETHOD. "MET2
ENDCLASS. "CHILD IMPLEMENTATION
START-OF-SELECTION.
DATA: OREF TYPE REF TO PARENT,
ORE1 TYPE REF TO CHILD.
CREATE OBJECT: OREF, ORE1.
CALL METHOD OREF->MET1.
CALL METHOD ORE1->MET2.
WRITE:/ OREF->VAR1.