I am working on a project that had been thought out, rather poorly. I have subclasses that access each other’s member functions. Here’s the situation:
class A {
public:
class B;
class C;
};
class A::B {
public:
void f() {
C:g();
}
}
class A::C {
public:
void g() {
B:f();
}
}
This code, obviously, runs into various errors which is too much list here. My question is, what is the solution to such a situation? Is it inheritance? If so, how? Is there any other way for me to preserve the “interplaying”-nature of classes B and C.
If you mean
C:g()–>C::g(),B:f()–>B::f()You can not call member function without object unless these member functions are static.
Probably a pointer to each other may resolve your issue?
I introduce pointer is because otherwise I need to write something to help with circular include issue. 🙂