*&---------------------------------------------------------------------*
*& Report ZCL_FRIEND
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZCL_FRIEND.
class c2 DEFINITION DEFERRED. "or
*class c2 DEFINITION .
* PUBLIC SECTION.
* methods: meth2.
*
* ENDCLASS.
class c1 DEFINITION FRIENDS c2 .
PRIVATE SECTION.
METHODs meth1.
ENDCLASS.
class c1 IMPLEMENTATION.
METHOD meth1.
write:/ 'this is c1'.
ENDMETHOD.
ENDCLASS.
class c2 DEFINITION .
PUBLIC SECTION.
methods: meth2.
ENDCLASS.
class c2 IMPLEMENTATION.
METHOD meth2.
write:/ 'this is c2'.
data: obj1 type ref to c1.
CREATE object obj1.
CALL METHOD obj1->meth1.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
data: obj type ref to c2.
CREATE OBJECT obj.
CALL METHOD obj->meth2.
*& Report ZCL_FRIEND
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZCL_FRIEND.
class c2 DEFINITION DEFERRED. "or
*class c2 DEFINITION .
* PUBLIC SECTION.
* methods: meth2.
*
* ENDCLASS.
class c1 DEFINITION FRIENDS c2 .
PRIVATE SECTION.
METHODs meth1.
ENDCLASS.
class c1 IMPLEMENTATION.
METHOD meth1.
write:/ 'this is c1'.
ENDMETHOD.
ENDCLASS.
class c2 DEFINITION .
PUBLIC SECTION.
methods: meth2.
ENDCLASS.
class c2 IMPLEMENTATION.
METHOD meth2.
write:/ 'this is c2'.
data: obj1 type ref to c1.
CREATE object obj1.
CALL METHOD obj1->meth1.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
data: obj type ref to c2.
CREATE OBJECT obj.
CALL METHOD obj->meth2.
No comments:
Post a Comment