I have an unsolved problem that I'd like to ask about circular dependencies in c++. Assume I have two classes that inherit from another class. In all of those three classes definitions, I've a member functions that initialize two objects from the other two, as follows.
class A{
public:
...
A* test(){
A* first=new B();
A* second= new C();
}
};
class B:public A{
public:
...
A* test(){
A* first=new A();
A* second= new C();
}
};
class C:public A{
public:
...
A* test(){
A* first=new A();
A* second= new B();
}
};
The compiler error that I get is: "error C2027: use of undefined type 'B'" and "error C2027: use of undefined type 'C'".