[Newbies] delegation vs inheritance

Michael Haupt mhaupt at gmail.com
Sat Aug 4 14:00:25 UTC 2007


Hi,

On 8/4/07, Ron Teitelbaum <Ron at usmedrec.com> wrote:
> I have to ask is Grunt your real name?  Do you have a real name?

indeed. I'd be interested to know as well.

Apart from what Ron has answered, I'd like to point out that Stack
does not delegate to LinkedList; what is being done there is
forwarding. The difference is subtle but important in certain
settings.

In case Stack would delegate to LinkedList, "self" would be the Stack
instance in all LinkedList methods invoked during Stack operations.
Delegation, however, is not supported directly in Smalltalk. Instead,
Stack forwards requests to LinkedList, implying that "self" is bound
to a LinkedList instance instead of a Stack instance in all LinkedList
methods invoked during Stack operations.

More on this can be found on
http://javalab.cs.uni-bonn.de/research/darwin/delegation.html.

Best,

Michael


More information about the Beginners mailing list