• Post Reply Bookmark Topic Watch Topic
  • New Topic

A class extending a class and implementing an interface with same methods ?  RSS feed

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if a class extends another class and implements an interface both with the same method , which function will it implement ??

eg:



which show() does c implement ??

thanks.
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The important thing is that the rules for the implementation of interfaces and abstract classes have been obeyed.

So, if you do


or



both will do the same thing...
 
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
'Albus':

Aren't you dead? You probably should change your username to your real name. Fake names are against the rules, and the moderators will get on your case.

John.
 
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
albus dumbeldore wrote:which show() does c implement ??

From a pragmatic standpoint, what's the difference? If the signatures are the same, the implementing subclass will be an instance of both the superclass and interface (unless I'm misunderstanding something).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!