This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes is-a relationship always relies on polymorphism Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "is-a relationship always relies on polymorphism" Watch "is-a relationship always relies on polymorphism" New topic
Author

is-a relationship always relies on polymorphism

Ali Khalfan
Ranch Hand

Joined: Nov 03, 2007
Posts: 126
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

Joined: Aug 15, 2006
Posts: 165
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.


Matt
Inquisition: open-source mock exam simulator for SCJP and SCWCD
 
Don't get me started about those stupid light bulbs.
 
subject: is-a relationship always relies on polymorphism
 
Similar Threads
problem with K&B Learnkey MasterExam question about hashCode & equals
Mock exam question is-a relationship
IS-A Test
Override vs Re-defination
IS-A RElationship