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

ABAP - OOPS : Use Of Nested Interface In Method Programming.

report ysubdel .
interface i1 .
methods m1.
endinterface.

interface i2.
methods : m1 , m2.
interfaces i1.
endinterface.

class c1 definition.
public section.
interfaces : i2.
endclass.

class c1 implementation.
method : i1~m1.
write:/5 'I am m1 from i1'.
endmethod.

method : i2~m1.
write:/5 'I am m1 from i2'.
endmethod.

method : i2~m2.
write:/5 'I am m2 from i2'.
endmethod.
endclass.

START-OF-SELECTION.
data : oref type ref to c1.
create object oref.
call method : oref->i1~m1 , “ Output : I am m1 from i1
oref->i2~m1 , “ Output : I am m1 from i2
oref->i2~m2 . “ Output : I am m1 from i2


Output:

I am m1 from i1
I am m1 from i2
I am m2 from i2

No comments:

Post a Comment