私は次のようなものをコンパイルしようとしています:
ああ
#include "B.h"
class A {
B * b;
void oneMethod();
void otherMethod();
};
A.cpp
#include "A.h"
void A::oneMethod() { b->otherMethod() }
void A::otherMethod() {}
Bh
#include "A.h"
class B {
A * a;
void oneMethod();
void otherMethod();
};
B.cpp
#include "B.h"
void B::oneMethod() { a->otherMethod() }
void B::otherMethod() {}
これまで、前方宣言の使用に問題はありませんでしたが、前方宣言されたクラスのみの属性やメソッドを使用できないため、今はそれを使用できます。
どうすればこれを解決できますか?