I have got four classes A, B, C and D.
A.h:
#include "B.h"
#include "C.h"
#include "D.h"
class A
{
public:
A() {};
void run() { B b; C c(b); };
};
B.h:
#include "D.h"
class B
{
public:
B() {};
};
C.h:
#include "B.h"
class C
{
public:
C(B b) { m_copy_b = &b; };
int blank(B& b) {}; // LINE 10
private:
B* m_copy_b; // LINE 12
};
D.h:
#include "C.h"
class D
{
public:
D() {};
};
And my main file:
#include "A.h"
int main()
{
A a;
a.run();
return 0;
}
Apart from the fact that the code sucks (it's just for the example), I get two errors while compiling the code:
include\C.h|10|error: 'B' has not been declared
include\C.h|12|error: 'B' does not name a type
I don't see how I could fix it, it worked well before I add the class D...
Any idea? Thanks!