TITLE: forward declaration of nested class? (Newsgroups: comp.lang.c++.moderated, 1 Sep 98) WOODARD: "Tim Woodard" writes: > Is there any way to forward declare a nested class without > including the definition of the parent class? For example: > // A.h > class A { > public: > class B { }; > }; > > // Some other file > // I don't want to #include "A.h" just to get A::B > class A; > class A::B; > > I know that this method doesn't work, but does anything else? CLAMAGE: clamage@Eng.Sun.COM (Steve Clamage) No. You cannot mention a member of a class unless the class definition is visible. You can un-nest the inner class and put both classes in a namespace: namespace AB { class A; class B; } In some other file you can provide the definitions of A and B. Unlike classes, namespaces can be re-opened and added to.