TITLE: Visibility of nested classes PROBLEM: dcb@slsvitt (David Binderman) Given the following code class A { public: class B { }; }; class C : public A { class D { B y; }; }; Then does the declaration of y require A::B or only B ? Or, is B accessable from D directly ? The ARM, Stroustrup 2 & Lippmann 2 didn't help in this case. RESPONSE: bs@alice.att.com (Bjarne Stroustrup) Well, the lookup rules in 10.4 of the manual (in the ARM or my 2nd edition) ought to have helped. In a class, having looked locally, you start looking for names in base classes. B is a name in the scope of A so that the B in `B y;' must refer to A::B. Names of nested classes obey all the usual lookup rules for member names. RESPONSE: dcb@slsvitt (David Binderman) Unfortunately, I looked at section 9.7 fourth sentence, which is the last sentence on page 185 in my copy of the ARM. The sentence seems to me to contradict the advice in 10.4 section. My understanding is that class D doesn't have class A as a base class, and so has no knowledge of its contents. RESPONSE: bs@alice.att.com (Bjarne Stroustrup) It doesn't. D's enclosing class is C. Naturally, the usable names from C includes those of C's public base A. D doesn't have A as its base but D's enclosing class C does.