Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-lcc!ames!pasteur!ucbvax!decwrl! From: ontologic!vilot@erl.mit.edu (Michael J. Vilot) Newsgroups: comp.lang.c++ Subject: Re: Visibility Bug in 1.2? Message-ID: <8901130337.AA11580@EDDIE.MIT.EDU> Date: 13 Jan 89 03:33:50 GMT Organization: Digital Equipment Corporation Lines: 42 Summary: It's not a bug! I did a little more research on the example. In particular, I re-read pp. 196-197 more carefully: "It is also possible to declare some, but not all, of the public members of a base class public members of a derived class. ^^^^^^ ^^^^^^ ... [on p. 192, employee::name & employee::department are _public_] ... Naturally, it is -> NOT <- possible to make a private member of a base class a public member of a derived class. ^^^^^^^ ^^^^^^ It is not possible to make overloaded names public using this notation." In his 1987 Usenix paper "The Evolution of C++: 1985 to 1987", Bjarne clears up some issues and adds some features to the language. Among the clarifications is a mention of this visibility issue (p. 4): "It was always possible to specify that a member of a private base should be considered public: ... [another example where the base members are _public_] ... "The complementary operation, making a member of public base private, is also allowed... << I tried this, it didn't seem supported ... >> Note that [doing this] implies that [the base class] is no longer a sub-type of [the derived class]: that is, there is no implicit coercion of a pointer to [the derived class] to a pointer to [the base class] and public members of [the base class] are not automatically public members of [the derived class]." I have also encountered a related issue: a friend of a derived class is _not_ automatically a friend of the base class -- if you really want this, you have to explicitly declare the function/class a friend of each. * BUT * (p. 195 of the book): "An alternative, and sometimes cleaner, solution is for the derived class to use only the public members of its base class."