• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

is-a relationship always relies on polymorphism

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic