prog.cpp:10:5: error: field ‘b’ has incomplete type ‘B’
B b;
^
prog.cpp:6:7: note: forward declaration of ‘class B’
class B;
^
prog.cpp: In member function ‘void A::do_something(B)’:
prog.cpp:12:23: error: ‘b’ has incomplete type
void do_something(B b) { this.b = b; }
^
prog.cpp:6:7: note: forward declaration of ‘class B’
class B;
^
prog.cpp:12:33: error: request for member ‘b’ in ‘(A*)this’, which is of pointer type ‘A*’ (maybe you meant to use ‘->’ ?)
void do_something(B b) { this.b = b; }
^
prog.cpp: In member function ‘B A::getB() const’:
prog.cpp:14:18: error: return type ‘class B’ is incomplete
B getB() const { return this.b; }
^
prog.cpp:14:32: error: request for member ‘b’ in ‘(const A*)this’, which is of pointer type ‘const A*’ (maybe you meant to use ‘->’ ?)
B getB() const { return this.b; }
^