*&---------------------------------------------------------------------*
*& Report YSAP_CLASS_DEFFERED
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ysap_class_deffered.
PARAMETERS: a TYPE i,
b TYPE i.
CLASS class2 DEFINITION DEFERRED.
*----------------------------------------------------------------------*
* CLASS class1 DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS class1 DEFINITION.
PUBLIC SECTION.
DATA: object2 TYPE REF TO class2.
ENDCLASS. "class1 DEFINITION
*----------------------------------------------------------------------*
* CLASS class2 DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS class2 DEFINITION.
PUBLIC SECTION.
METHODS: sum.
DATA: num TYPE i .
ENDCLASS. "class2 DEFINITION
*----------------------------------------------------------------------*
* CLASS class2 IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS class2 IMPLEMENTATION.
METHOD sum.
num = a + b.
WRITE: num.
ENDMETHOD. "sum
ENDCLASS. "class2 IMPLEMENTATION
START-OF-SELECTION.
DATA: object1 TYPE REF TO class1.
CREATE OBJECT: object1.
CREATE OBJECT: object1->object2.
CALL METHOD: object1->object2->sum.
Output:
*& Report YSAP_CLASS_DEFFERED
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ysap_class_deffered.
PARAMETERS: a TYPE i,
b TYPE i.
CLASS class2 DEFINITION DEFERRED.
*----------------------------------------------------------------------*
* CLASS class1 DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS class1 DEFINITION.
PUBLIC SECTION.
DATA: object2 TYPE REF TO class2.
ENDCLASS. "class1 DEFINITION
*----------------------------------------------------------------------*
* CLASS class2 DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS class2 DEFINITION.
PUBLIC SECTION.
METHODS: sum.
DATA: num TYPE i .
ENDCLASS. "class2 DEFINITION
*----------------------------------------------------------------------*
* CLASS class2 IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS class2 IMPLEMENTATION.
METHOD sum.
num = a + b.
WRITE: num.
ENDMETHOD. "sum
ENDCLASS. "class2 IMPLEMENTATION
START-OF-SELECTION.
DATA: object1 TYPE REF TO class1.
CREATE OBJECT: object1.
CREATE OBJECT: object1->object2.
CALL METHOD: object1->object2->sum.
Output:
No comments:
Post a Comment