[Newbies] delegation vs inheritance
Ron at USMedRec.com
Sat Aug 4 13:48:44 UTC 2007
I have to ask is Grunt your real name? Do you have a real name?
Ok so your question is very vague. I'll try to answer, but I'm not sure my
answer will be much help.
Stack is a specialization of Object
Stack has a linked list
Stack normally implements linked list as a collection of StackLinks.
StackLink is a specialization of Link
Link has a nextLink that normally points to an instance of Link (or it's
subclasses) to provide a linked list structure.
Does that help?
> -----Original Message-----
> From: gruntfuttuck
> First of all I must apologise if I get some terminology wrong in this
> I was rummaging around the collection classes earlier today and came
> 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
> As you can see I'm a bit vague on all this. With class Stack what would
> be the likely thinking to delegate as apposed to inherit? I think this is
> very impotent subject and I would like to be clearer on it.
> View this message in context: http://www.nabble.com/delegation-vs-
> Sent from the Squeak - Beginners mailing list archive at Nabble.com.
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
More information about the Beginners