interfaces with identical methods
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   vinayaka_nagendra
Posted On:   Thursday, November 8, 2001 04:22 AM

If two interfaces are implemented having identical methods, when the method is called, how can we know from which interface the method is called?

Re: interfaces with identical methods

Posted By:   Andrew_Cuthbertson  
Posted On:   Wednesday, November 28, 2001 06:33 AM

If you use the proxy generator in java.lang.reflect then the invocation handler will get the method that was invoked.

Re: interfaces with identical methods

Posted By:   Naveed_Azhar  
Posted On:   Thursday, November 8, 2001 04:35 AM

A Simple mechanism:
If some method is present in two interfaces named like ( Interface1 and Interface2 ) and some class implements both interfaces.

There will be a compile time error which if the return types of methods are different.

If you make return type of that method in both classes same then it will become completely identical.

And there will be only one implementation ( in the implementation class ). So, there is no question "from which interface the method is called?"
:)


naveed@hotmail.com
About | Sitemap | Contact