[Newbies] delegation vs inheritance

gruntfuttuck gruntfuttuck at gmail.com
Sat Aug 4 13:32:44 UTC 2007


First of all I must apologise if I get some terminology wrong in this post.

I was rummaging around the collection classes earlier today and came across
class Stack. I was interested to see that it makes use of class LinkedList
through delegation with a instance variable rather than inheritance.
I'm tyring to remember my Analysis and Design course here. I have a foggy
memory about a is-a and has-a relationship. So a ford is-a type of Car, so
that is a inheritance relationship and a Car has an engine so that is a
delegation relationship. I also know that delegation is better for loose
Coupling.

As you can see I'm a bit vague on all this. With class Stack what would the
be the likely thinking to delegate as apposed to inherit? I think this is a
very impotent subject and I would like to be clearer on it.
-- 
View this message in context: http://www.nabble.com/delegation-vs-inheritance-tf4216781.html#a11996570
Sent from the Squeak - Beginners mailing list archive at Nabble.com.



More information about the Beginners mailing list