Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uakari.primate.wisc.edu!zazen!decwrl!pa.dec.com!hollie.rdg.dec.com!decvax.dec.com!zinn!nuucp From: mjv@objects.mv.com (Michael J. Vilot) Newsgroups: comp.lang.c++ Subject: Re: Nonvirtual base classes in MI Message-ID: <1174@zinn.MV.COM> Date: 8 Feb 91 02:40:22 GMT Sender: nuucp@zinn.MV.COM Lines: 36 Keith Gorlen commented on my design decisions in the Booch Components library: >It seems to me that there is little, if any, advantage to using private >inheritance as opposed to simply including an instance of the class as a member >variable, I agree with Keith, and with Tom Cargill, that private base classes can be transformed into class members. There may be some minor performance differences between the two, but I suspect on average it's a wash. > Are there more compelling reasons for using private inheritance than this? Compelling? Probably not -- certainly not, in any absolute sense. Are there _compelling_ reasons for deriving all classes from a root class Object? Again, probably not. On the other hand, such decisions may make sense within a given set of design goals and constraints. Each decision represents a particular design choice. In my case, I used private derivation to express the difference between the abstract class and the ``concrete'' classes derived from it -- the derived classes mix in their representation. Making the representation class a private base separates it from the other members of the class, and highlights the design decision. |> The second use I made of MI was to mix in specific behavior for Node classes in |> the unbounded representations. >Is this also a case of private inheritance? No, in this latter case the derivation has to be public: Node classes mixing in Managed behavior (similarly for Shared) make the added members publicly available. The simplicity of the Managed and Controlled forms hinges on the transparent substitution of ``new'' and ``delete'' that occurs as a result. I'm looking forward to a lively discussion in Washington ! -- Mike Vilot, ObjectWare Inc, Nashua NH mjv@objects.mv.com (UUCP: ...!decvax!zinn!objects!mjv)