A bit of a noob question: I need classes A and B such that A has a B* member and B has an A* member.
When compiling I get "error: ISO C++ forbids declaration of ‘B’ with no type". How can I get around this?
Forward declare B (or A )
class B; //forward declaration of B
class A
{
B *b;
};
class B
{
A *a;
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With