I have 2 classes that must have members of each other (ie A is a member of B and B a member of A). How do I do this without incomplete type errors?
If you're wondering if there's a way to restructure the program so as to avoid interdependency, I don't think it is. I'm using OOAD to simulate neural networks and my problem arises from the interdependency between dendrites/synapses and neurons.Code:class A
{
public:
A(class B &b) : _b(b) {}
void func()
{
_b.func();
}
private:
class B _b;
};
class B
{
public:
B(class A &a) : _a(a) {}
void func()
{
_a.func();
}
private:
class A _a;
};
Thanks for your time and help.