File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is-a relationship always relies on polymorphism

 
Ali Khalfan
Ranch Hand
Posts: 129
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This statement comes from K & Bs master exam.

IS it true? why does it ALWAYS rely on polymorphism?

What does the statement mean anyway?
 
Matt Russell
Ranch Hand
Posts: 165
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately, it's a bit of a vague and confusing statement. In good object-oriented design, you express an "is-a" relationship using subclassing. Polymorphism is a mechanism that lets you treat instances of subclasses of a particular class as if they were instances of that class itself. So I think you could say that classes in an "is-a" relationship can, and should, take advantage of polymorphism, and that's perhaps what the K&B statement was getting at.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic