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

ABAP - OOPS: Using ALIASES In Method Programming.

report ysubdel .
interface i1 .
methods m1.
endinterface.

interface i2.
methods : m1 , m2 .
interfaces i1.
aliases meth1 for i1~m1.
endinterface.

class c1 definition.
public section.
interfaces : i2.
aliases meth2 for i2~m2.
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->i2~meth1.
call method : oref->meth2 .


Output:

I am m1 from i1
I am m2 from i2

No comments:

Post a Comment