This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
forwad declaration for nested classes
- From: thomas dot porschberg at osp-dd dot de
- To: libstdc++ at gcc dot gnu dot org
- Date: Tue, 15 Jan 2002 09:27:21 +0100
- Subject: forwad declaration for nested classes
Is it possible to declare a nested class forward in a handle class?
I have the following problem:
A class "DBActionImpl" has a method that returns a Pointer to a inner class
"DS" from class "CacheSubArtPromoGr".
The declaration in DBActionImpl is:
CacheSubArtPromoGr::DS* CacheSubArtPromoGrSub_GetSubArtPromoGr(short tHaeufigkeitImSet);
the appropriate include is "#include <CacheSubArtPromoGr.hh>"
In DBAction, my handle class, I want to have a method
CacheSubArtPromoGr::DS* CacheSubArtPromoGr_GetSubArtPromoGr(short tHaeufigkeitImSet);
the implemetation is simple:
{
return impl->CacheSubArtPromoGr_GetSubArtPromoGr(tHaeufigkeitImSet);
}
where impl is the pointer to the implementatin class.
I have to publish "CacheSubArtPromoGr::DS" in the header file of the handle class.
But the declaration
class CacheSubArtPromoGr::DS;
is rejected by the compiler with:
DBAction.hh:7: aggregate `CacheSubArtPromoGr DS' has incomplete type and cannot
be initialized
Okay, I could include <CacheSubArtPromoGr.hh> in my handle class, but is there
a better way?
compiler: gcc3.0.1
platform: linux
lib: g++-v3
--
PALOMA-system is a treasure, hanger or large item and stored in the wrong area (Loc. 1/K/99/91/1)