[SOLVED] Cross referencing classes in C++
Posted: Fri Jun 29, 2007 12:10 am
If I had the following classes:
classA.h:
classB.h:
How could I do this without the compiler (VC++ 8) giving me
?
classA.h:
Code: Select all
#ifndef CLASSA_H
#define CLASSA_H
#include "classB.h"
class ClassA
{
public:
// constructor, other public members
private:
ClassB *child;
// other private members
};
#endif
Code: Select all
#ifndef CLASSB_H
#define CLASSB
#include "classA.h"
class ClassB
{
public:
// constructor, other public members
private:
ClassA *parent;
// other private members
};
#endif
Code: Select all
error C2061: syntax error : identifier 'ClassB'