Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!odi!benson From: benson@odi.com (Benson I. Margulies) Newsgroups: comp.lang.c++ Subject: Data Hiding, private members, and globals Message-ID: <391@odi.ODI.COM> Date: 4 Jul 89 18:36:57 GMT Reply-To: Benson I. Margulies Organization: Object Design Inc., Burlington, MA Lines: 32 in 2.0: class C1 { private: int x; }; class C2 : private C1 { int y(); }; int x; int C2::y () { return x; } takes an "attempt to reference private member X" error. In other words, if I happen to pick a global name that matches an inaccessible private member of my class, I get yelled at. I consider it sort of backwards to have to carefully check all the variable I can't reference when choosing my names. It makes namespace pollution prevention difficult, since as a purveyor of a base class I can't add any private name without the risk of causing errors for my customers' classes. -- Benson I. Margulies