• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Implementing an interface by changing the argument name

 
O. Ziggy
Ranch Hand
Posts: 430
Android Debian VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the following example



The code implements the interface but the argument in the bounce method is different in that it is using a different name i.e.



The code compiles and runs fine. I thought that the above is considered to be overloading i.e. the argument list has changed.
 
Matthew Brown
Bartender
Posts: 4566
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What identifies a method is the name of the method and the types of the argument list. The names of the arguments don't matter.

If that was considered overloading, and I made the call bounce("Bounce this"), which method would you expect to be called? There'd be no way of telling.
 
Christian Joseph
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Identifiers (name)doesn't matter.. Yap thats will run smooth
 
O. Ziggy
Ranch Hand
Posts: 430
Android Debian VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matthew Brown wrote:If that was considered overloading, and I made the call bounce("Bounce this"), which method would you expect to be called? There'd be no way of telling.


Ok i see what you mean.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic