Say you have two classes, class A and class B. class A is defined first, but class B has a prototype. When I make a method in class A whose argument is of type B&, I get a strange error message from the compiler saying " invalid use of undefined type 'struct B' ".
Why am I getting this error, and what should I do to fix it?
I get the following error:Code:
void test(B& something)
something.x = 0;
In member function `void A::test(B&)':
(8) invalid use of undefined type `struct B'
(1) forward declaration of `struct B'
I'm using Dev-C++.