Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!ux1.cso.uiuc.edu!ux1.cso.uiuc.edu!m.cs.uiuc.edu!p.cs.uiuc.edu!johnson From: johnson@p.cs.uiuc.edu Newsgroups: comp.object Subject: Re: Inheritence and Delegation Message-ID: <135300005@p.cs.uiuc.edu> Date: 13 Oct 89 11:45:00 GMT References: <126109@sun.Eng.Sun.COM> Lines: 18 Nf-ID: #R:sun.Eng.Sun.COM:126109:p.cs.uiuc.edu:135300005:000:896 Nf-From: p.cs.uiuc.edu!johnson Oct 13 06:45:00 1989 >Lynn Stein, a graduate student here at Brown, proved that delegation and >inheritance are equivalent. Hence, inheritance is not a "special case" of >delegation. For the proof, see her paper in the OOPSLA '87 Proceedings: >"Delegation Is Inheritance." The proof consisted of reducing all objects to metaclasses. This is not very convincing unless you have Smalltalk style metaclasses in your language. Thus, the proof does not apply to C++, Eiffel, etc. I think that it is better to reduce delegation to regular message passing. It is easy to write a stub that implements a message by forwarding it to a component. If you also pass along the receiver as an argument to the message then the delegatee can send messages to the original receiver. This is the essence of delegation. In my experience, the overhead of having to do it yourself is so small as to be negligible. Ralph Johnson