Original Post
Hi.:) I have a project Im working on and I have this error come up on compile. error: field `b' has incomplete type. After googling it, it seems to be when you try to access a variable that hasnt been initialized (I think that's the word.)But Im getting the problem before I try to do anything with it. Here's the code: A.h B.h C.h Thank you!
#ifndef A_H
#define A_H
#include "B.h"
class B;
class A
{
public:
A();
virtual ~A();
protected:
private:
B* b; //The error is here, though I guess it would happen to all.
//I also forgot to add that b is a pointer. >_>
};
#endif // A_H
#ifndef B_H
#define B_H
#include "C.h"
class C;
class B
{
public:
B();
virtual ~B();
protected:
private:
C c;
};
#endif // B_H
#ifndef C_H
#define C_H
#include "A.h"
class A;
class C
{
public:
C();
virtual ~C();
protected:
private:
A a;
};
#endif // C_H