| Author |
Interface questions
|
Parameswaran Thangavel
Ranch Hand
Joined: Mar 01, 2005
Posts: 485
|
|
when i changed the reference variable type as AnInterfaceIml ai then there is no error... why???
|
 |
vidya sagar
Ranch Hand
Joined: Mar 02, 2005
Posts: 580
|
|
|
Because baseclass or baseinterface reference can hold derived class object
|
 |
vinuharan haran
Ranch Hand
Joined: Feb 26, 2005
Posts: 64
|
|
Hi, If the type of the object is AnInterface,the method declaration in that interface has throws clause.Hence the compiler complains. If the type of the object is AnInterfaceImpl, the method declaration in that class doesn't have the throws clause.so the compiler doesn't complain. -vinu.
|
 |
Parameswaran Thangavel
Ranch Hand
Joined: Mar 01, 2005
Posts: 485
|
|
hi vinu i didn't get what u r telling.. here the methods r overridden.since the overridden methods are called based on the objcet type rather than the reference variable type. the overridding method didn't violate any contract for overridding. Then why it getting error..
|
 |
 |
|
|
subject: Interface questions
|
|
|