| Author |
what exactly an interface object contains ?
|
RohitR Kulkarni
Greenhorn
Joined: Aug 30, 2008
Posts: 2
|
|
what exactly an interface object contains when we declare it to achieve correct method invocation? how it correctly works? suppose i have two interfaces each having one method with same method name. a class implements this interface. how using an interface object and assigning that object a class object calls the method from that interface only???
|
 |
Akhilesh Trivedi
Ranch Hand
Joined: Jun 22, 2005
Posts: 1493
|
|
Originally posted by RohitR Kulkarni: what exactly an interface object contains when we declare it to achieve correct method invocation? how it correctly works? suppose i have two interfaces each having one method with same method name. a class implements this interface. how using an interface object and assigning that object a class object calls the method from that interface only???
An interface is just a specification, a skeleton, there is no body, there is no implementation. You would feel its importance only at runtime.
|
Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 9948
|
|
an interface declares a set of methods the implementing class MUST define. it simply says "any and all classes that implement me will have the following methods with the following signatures". If you have two interfaces that both declare the same method, it's not a problem. the one method you write will satisfy that part of both interfaces. you kind of get two-for-one.
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
Amit Ghorpade
Bartender
Joined: Jun 06, 2007
Posts: 2552
|
|
|
I think the subject is a bit confusing one, there is no such thing as interface object there is only a reference of the interface type that holds an object of the implementing class.
|
SCJP, SCWCD.
|Asking Good Questions|
|
 |
 |
|
|
subject: what exactly an interface object contains ?
|
|
|