Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"Is -A" relationship

 
Rob Michaelson
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the �Is-A� relationship?
 
chi Lin
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob,
"is-A" relationship used on inheritance to describe parent/child realtionship.
eg :
Occupation class as parent class,
Programmer, CabDriver being child class of Occupation.
in Java we say
Programmer extends Occupation
CabDriver extends Occupation
we then decribe the relationship like :
Programmer is-A Occupation
CabDriver is-A Occupation
[ July 21, 2003: Message edited by: chi Lin ]
 
Rob Michaelson
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is great - Thank You!!
R
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is-A is a helpful way to hunt for opportunities for inheritance, but it is not the only way and it is not always right and inheritance is not the only way to "be" something else. So if you see something in the real world that "is a" something else but inheritance makes no sense in code, listen to the code.
When using inheritance, you should also be aware of the Liskov Substitution Principle. Do a Google search for papers and see how it complicates the simple "Is-A" some times.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic