wood burning stoves 2.0*
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


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
 
GeeCON Prague 2014
 
subject: is-a relationship always relies on polymorphism