‎2009 Jan 30 1:48 PM
hi Frnds,
i have got a class which is having a interface method. I want to implement that method in that class only. but when i Double Click on it then it is showing that it is implementated in a different class.
how can i implement it in that class only.
Thanks
Rohit
‎2009 Jan 30 2:24 PM
Hi Rohit,
Interface methods can only be implementaed during the run time.
You have to assign the interface in the interface tab of the class t code se24
Once you activate the class the available methods of the interface are displayed in the mehods tab of the class T code se24
When you create an instance of this class in your program you can use the interface methods with the created object reference.
Hope you understand
Regards
Pavan
‎2009 Jan 30 2:41 PM
You will have define a local private method in that case.
An interface can be used in many classes, it is not possible to control where it can be implemented.
But the implementation of that method can be different in different classes and you can also add more parameters other than those that are inherited from the interface.
This is called polymorphism concept of OOPs and is the standard way.
regards,
Advait
‎2009 Jan 31 11:49 AM
hI Frnds,
I am having a zclass . The interface is also zinterface which i can view in se24. Actualy my zclass is having a superclass. SO when i double click on the interface it shows me that it is implemented in the superclass . So i want to implement that method in that class only.
Pls help
Thanks
Rohit
‎2009 Feb 01 12:09 PM
Hi Rohit,
You have to redefine this method. Just put cursor on this method, now click on redefine button
( Just next to FIND NEXT button ). Now you can implement this method in your class, but in redefined method you cannot change its import-export parameters i.e signature of method.
Regards
Abhijeet
‎2009 Feb 01 1:07 PM
Hi ROHIT,
when i double click on the interface it shows me that it is implemented in the superclass
As interface is always implemented in public section of a class, it is already implemented in all its subclasses. Therefore you already have the implementation done. As my predecessors said you cannot control were it is implemented (besides your implementation), but you can redefine it. It will then have a different implementation than it has in superclass. Without this your class cannot impelemnt it once again as name conflict would arise. This is because you already have one implementation of that interface method in you public section (made in supperclass).
Hope this is clear
Marcin
‎2009 Feb 02 9:05 AM
Thanks Frnds,
got the perfect answer i was looking for.
Rohit