Path: utzoo!attcan!uunet!lll-winken!ames!elroy!usc!orion.cf.uci.edu!uci-ics!siam.ics.uci.edu!schmidt From: schmidt@siam.ics.uci.edu (Doug Schmidt) Newsgroups: comp.lang.c++ Subject: Re: nit-picking - Edition #3 (multiple inheritance) Keywords: nits Message-ID: <14133@paris.ics.uci.edu> Date: 12 May 89 06:12:38 GMT References: <203@riunite.ACA.MCC.COM> <1527@cod.NOSC.MIL> Sender: news@paris.ics.uci.edu Reply-To: Doug Schmidt Organization: University of California at Irvine: ICS Dept. Lines: 65 Here's a quick nit. Is the following a legal use of multiple inheritance? As you can see, from one direction class a's member function `int foo ()' is private for all classes derived from class b. However, on another path it is public. In class d's constructor, where `foo ()' is called, foo appears to be derived from classes where it is both private and public. Which visibility status prevails? Is this ambiguous, legal, or illegal? thanks, Doug ---------------------------------------- class a { public: int foo () { printf ("foo\n"); } a () {printf ("a\n");} }; class b : public a { private: a::foo; // made private for all classes derived from class b. public: b () {printf ("b\n");} }; class c : public a { public: c () {printf ("c\n");} }; class d : public c, public b { public: d () { printf ("d\n"); foo (); // both public *and* private!! which prevails? } }; class e : public d { public: e () { printf ("e\n"); } } main () { e eek; b *beek = &eek; } -- On a clear day, under blue skies, there is no need to seek. And asking about Buddha +------------------------+ Is like proclaiming innocence, | schmidt@ics.uci.edu | With loot in your pocket. | office: (714) 856-4043 |