G
gbook
I'm trying to nest classes and access the variables in each one from
the other. I mainly just want to access the outer class from the inner
class. Here is the code I have so far... It compiles, but I can't
declare an instance of the inner class inside the outer class.
class ImageData
{
.... ...
....
class LoadFile;
// LoadFile* loadFile; // doesn't compile this line!
friend class LoadFile;
};
/* class to load all different types of files */
class ImageData::LoadFile
{
friend class ImageData;
public:
LoadFile(ImageData *imgdata);
~LoadFile(void);
private:
ImageData *imgData;
};
How can I go about this? Is there something special about VC++2005?
-Greg
the other. I mainly just want to access the outer class from the inner
class. Here is the code I have so far... It compiles, but I can't
declare an instance of the inner class inside the outer class.
class ImageData
{
.... ...
....
class LoadFile;
// LoadFile* loadFile; // doesn't compile this line!
friend class LoadFile;
};
/* class to load all different types of files */
class ImageData::LoadFile
{
friend class ImageData;
public:
LoadFile(ImageData *imgdata);
~LoadFile(void);
private:
ImageData *imgData;
};
How can I go about this? Is there something special about VC++2005?
-Greg