Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!brunix!sdm From: sdm@cs.brown.edu (Scott Meyers) Newsgroups: comp.lang.c++ Subject: Re: Nonvirtual base classes in MI Message-ID: <63176@brunix.UUCP> Date: 31 Jan 91 20:14:36 GMT References: <1159@zinn.MV.COM> Sender: news@brunix.UUCP Reply-To: sdm@cs.brown.edu (Scott Meyers) Organization: Brown University Department of Computer Science Lines: 40 In reponse to my posting, Michael J. Vilot described his uses of nonvirtual base classe with MI. His examples were interesting, but I didn't see any uses of a DAG. Perhaps I wasn't explicit enough in what I was looking for. What I want to see is an example that can be boiled down to this: A class A { ... }; / \ / \ B C class B: public (or private) A { ... }; \ / class C: public (or private) A { ... }; \ / D class D: (optionally virtual) public (or private) B, (optionally virtual) public (or private) C { ... }; What's important here is that neither B nor C inherits from A as a virtual base. That results in the memory layout of a D object looking like this, at least conceptually: +------------+ | B's A Part | +------------+ | B Part | +------------+ | C's A Part | +------------+ | C Part | +------------+ | D Part | +------------+ Notice that there are two A parts in a D object. For the record, I fully agree with Michael's distinction between public and private inheritance. I'm especially interested in examples of the above the use only public inheritance. Scott ------------------------------------------------------------------------------- What do you say to a convicted felon in Providence? "Hello, Mr. Mayor."