‎2012 May 21 6:33 AM
Hi,
I created zinter interface in that method zmethod is there. I inherited this interface to zinterface1 and zinterface2. Again I defined the method zmethod1 in both interfaces zinterface1 and zinterface2. Now If I am inheriting the 2 interfaces zinterface1 and 2, in the class only zinterface1~method1 and zinterface2~method1 are displaying. Why zinter interface method zmethod is not displaying ?
the hierarchy is like below.
zinter - method
zinterface1 inherited from zinter having method zmethod1
zinterface2 inherited from zinter having method zmethod1.
zclass inherited from zinterface1 and zinterface2 having method zinterface~method1 and zinterface~method1.
Thank you.
‎2012 May 22 3:41 PM
What you are trying in implementing the Composite Interface. In an interface, a component will only appear once even though it is defined multiple times. E.g. in you example, ZINTER is defined more than once in the Class definition as part of ZINT1 and ZINT2. You would be only able to create a Single implementation of ZINTER~ZMETHOD.
sk yakub wrote:
Why zinter interface method zmethod is not displaying ?
I guess you referring to the Tree hierarchy display. Since you have declared your concrete class with INTERFACEs: zint1, zint2. only they are visible as in Class hierarchy. If you drill down the interface hierarchy of ZINT1, you would see the ZINTER.
Regards,
Naimesh Patel
‎2012 May 23 6:50 AM
Hi Yakub,
I have tried this it is displaying zmethod of zinter interface.
Interface methods are always referred by the interface in which it is defined. It does not depend on the interface that is implementing that interface.
Suppose you have an interface name ZIF_SUPER, In this interface you have some method named add. Now if there are two more interfaces named ZIF_SUB1 & ZIF_SUB2 they both are implementing the interface ZIF_SUPER. Now both the interface will have method ZIF_SUPER~ADD.
Now suppose if you add one more method named MINUS to both the interface and then implement both the interface in One class suppose ZCL_INTERFACE_TEST, then in this class only three method named ZIF_SUPER~ADD , ZIF_SUB1~MINUS and ZIF_SUB2~MINUS will be available to you.
Regards
Ajeet Pratap Singh
‎2013 Feb 04 11:11 AM
Hi,
To inherit methods of an interface into another, you just have to define its usage in the interface and not redefine the methods again.
e.g > interfaceA with method a_1 , interfaceB with method b_1, interfaceC with method c_1.
Now i want methods of interfaceA to be inherited in interfaceB and interfaceC so what i do is define its usage.
INTERFACE interfaceB DEFINITION.
INTERFACES interfaceA.
INTERFACEEND.
INTERFACE interfaceC DEFINITION.
INTERFACES interfaceA.
INTERFACEEND.
Thats all and such type of interfaces including other interfaces are called Composite Interfaces.
Now in a class abc.
CLASS abc DEFINITION.
INTERFACES interfaceB
ENDCLASS.
CLASS abc IMPLEMENTATION.
METHOD interfaceA~a_1.
...
...
ENDMETHOD.
METHOD interfaceb~b_1.
...
...
ENDMETHOD.
ENDCLASS.
Thank You.