X
xiaohuamao
Beside declare independent abstract classes, is there any other methods
to solve the problem of cyclic dependencies?Like the following one,
which causes compile error of undefined type.
class Child;
class Parent
{
public:
int a;
Child *myChild;
bool test() {return myChild->b == 0;}
};
class Child
{
public:
int b;
Parent *myParent;
bool test() {return myParent->a == 0; }
};
int main()
{
return 0;
}
to solve the problem of cyclic dependencies?Like the following one,
which causes compile error of undefined type.
class Child;
class Parent
{
public:
int a;
Child *myChild;
bool test() {return myChild->b == 0;}
};
class Child
{
public:
int b;
Parent *myParent;
bool test() {return myParent->a == 0; }
};
int main()
{
return 0;
}