Topic: Forward declaring nested classes
Author: "Jeff Grills" <jgrills@soe.sony.com>
Date: Sat, 22 Dec 2001 03:17:41 CST Raw View
I find myself frequently having to include a header file just to be able to
write an interface that uses a nested class. To avoid this, I'd need to be
able to forward declare nested classes in C++. For instance:
in file Object.h:
class Object
{
public:
class Nested
{
};
};
in file Second.h:
class Object;
class Object::Nested;
void function (Object::Nested &objectNested);
I recently read that it was close to time to consider changes for the next
revision of the C++ standard language. I thought I'd bring this point up
and see if others felt this was a worthy change to the language.
Thanks,
Jeff Grills
Technical Director, Austin Studio
Sony Online Entertainment
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
Author: jthill_@mac.com (Jim Hill)
Date: Sat, 22 Dec 2001 17:44:04 CST Raw View
"Jeff Grills" <jgrills@soe.sony.com> wrote in message news:<3c239f2b$0$17897@news.denver1.Level3.net>...
> class Object;
> class Object::Nested;
I can't think of any way to compile this without requiring direct
linker support for C++'s access rules including friendship and scope -
even for inline functions' use of such names. It opens huge
opportunities for hidden access-rule violations or mysterious failures
to link.
That said, I wouldn't mind having it either.
Jim
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]