The source was compiled with errors. I find the problem can't be solved until the mutual type reference is avoided in the code. I wonder if there is there any solution to this situation. Thanks!
class B;
class A {
public:
struct C {
};
B b;
};
class B {
public:
void func(A::C & c) {} ;
};
em, i don't understand. in the first line, Class B is only a declaration. if i haven't define it, how can i define a member of Class B ? However, a pointer to Class B might be o.k? Why?
i just don't understand
Line 6 doesn't work because sizeof( A ) is directly dependent upon sizeof( B ), which has not yet been defined.
If line 6 were a pointer-to-B instead of an instance, the dependency is broken since sizeof( A ) would then
be dependent upon sizeof( B* ), which is in no way related to sizeof( B ).