I have a class setup like this:
class b;
class a
{
b var;
};
class b
{
a var;
};
How do i make it work?
Thanks in advance!
>Solution :
This setup, as it’s written, isn’t possible – an instance of a contains an instance of b, which in turn contains an instance of a, which then contains an instance of b, ad infinitum.
Instead, you need the classes to hold pointers to each other:
class a {
b* b;
};
class b {
a* a;
};