This week's giveaway is in the Threads forum.
We're giving away four copies of Java Concurrency Live Lessons and have Doug Schmidt on-line!
See this thread for details.
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference between polymorphism and inheritance  RSS feed

 
jo sim
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I know about overriding, overloading, extending classes. I just dont know the difference between polymorphism and Inheritance.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See How my dog learned polymorphism, and let us know if that clears it up.
 
Campbell Ritchie
Sheriff
Posts: 53779
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This sort of question comes up frequently; you can get answers by searching. I wrote about it myself about a week ago here.

Polymorphism is one of the features or results of inheritance.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:

Polymorphism is one of the features or results of inheritance.


That's not true. What is true is that *in Java* polymorphism is coupled to inheritances. But there are languages that provide polymorphism without the need for inheritance; and there are other languages that have inheritance without polymorphism.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!