Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Implementation of method

Former Member
0 Likes
1,809

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

6 REPLIES 6
Read only

Former Member
0 Likes
1,328

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

Read only

Former Member
0 Likes
1,328

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

Read only

Former Member
0 Likes
1,328

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

Read only

0 Likes
1,328

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

Read only

0 Likes
1,328

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

Read only

0 Likes
1,328

Thanks Frnds,

got the perfect answer i was looking for.

Rohit