Sorry to ask a really basic programming question, but it's driving me
mad! I am sure somebody knows the answer.
Trying to get two mutually linked classes in eVC3. Sometimes it will
compile, sometimes it will not. No idea why. This seems to work sometimes:
-------------------foo.cpp-----------------------
#include "foo.h"
-------------------foo.h-------------------------
#pragma once
class foo;
#include "bar.h"
class foo { public: bar *p; };
-------------------bar.h-------------------------
#pragma once
class bar;
#include "foo.h"
class bar { public: foo *p; };
-------------------------------------------------
And sometimes I'll get:
Compiling...
foo.cpp
bar.h(4) : error C2079: 'p' uses undefined class 'foo'
Can somebody suggest some probably obvious reason why this model
sometimes will compile, and sometimes will not. Or suggest a better, or
correct, method in eVC3 to mutually link classes.
Thanks and regards, Ben.