GLOBAL FRIENDS
. This addition is generated when a global class is created by
Class Builder if friends are entered on
the appropriate tab.
Latest notes: The addition FRIENDS must be specified as the last
addition after all other additions.
Example ABAP Coding In this example, the interface i1 and therefore
the implementing class c2 are friends of the class c1 . The
class c2 can instantiate c1 and access its private
component a1 .
INTERFACE i1.
...
ENDINTERFACE.
CLASS c1 DEFINITION CREATE PRIVATE FRIENDS i1.
PRIVATE SECTION.
DATA a1 TYPE c LENGTH 10 VALUE 'Class 1'.
ENDCLASS.
CLASS c2 DEFINITION.
PUBLIC SECTION.
INTERFACES i1.
METHODS m2.
ENDCLASS.
CLASS c2 IMPLEMENTATION.
METHOD m2.
DATA oref TYPE REF TO c1.
CREATE OBJECT oref.
cl_demo_output=>display_text( oref->a1 ).
ENDMETHOD.
ENDCLASS.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved