Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!dptg!ulysses!andante!alice!ark From: ark@alice.UUCP (Andrew Koenig) Newsgroups: comp.lang.c++ Subject: Re: Why can't access control be used to disambiguate between ba Message-ID: <9750@alice.UUCP> Date: 5 Aug 89 05:22:14 GMT References: <2408@ginosko.samsung.com> <13073@polyslo.CalPoly.EDU> <406@odi.ODI.COM> Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 33 In article <406@odi.ODI.COM>, dlw@odi.com (Dan Weinreb) writes: > Exactly the same issue arises in SINGLE inheritance as well; this is > not an issue specific to multiple inheritance. Namely, if I write a > class, with a private data member "a", and then you want to subclass > it, and you happen to choose "a" as the name of a data member, you'll > get an error message from the compiler. The name "a", although > private, is still apparent to the subclass writer; there is no name > hiding here. Not quite. Member names follow scope rules. For example: class Foo { private: int a; }; class Bar: public Foo { private: int a; public: void zot() { a = 0; } }; No problem. The use of to `a' in Bar::zot() refers unambiguously to Bar::a. The fact that Foo::a exists is irrelevant because defining `a' in class Bar hides Foo::a. -- --Andrew Koenig ark@europa.att.com