Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How the code reusability is achieved by using Polymorphism?  RSS feed

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear friends
Please give me a some explain to, how the code reusability is achieved by using Polymorphism. So what is the Polymorphism? I used the google. But i have not a correct answer. As well as how to provide it using overriding and overloading? that's the big problem to me......
 
author & internet detective
Marshal
Posts: 37518
554
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ted North has a good discussion in this thread. As far as reusability, think about how you would do the same thing without polymorphism. You'd have to copy the code/methods into multiple objects. or have a static method somewhere that you would have to call from multiple places.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!