forwad declaration for nested classes
Tue Jan 15 00:25:00 GMT 2002

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)

More information about the Libstdc++ mailing list