循環依存の問題があります。2 つのヘッダー ファイルがあり、それぞれが相互に依存しています。私が抱えている問題は、名前空間内のクラスに関係しています。
ファイル #1
class Player; // This is how I forward declare another class
namespace sef {
class Base
{
public:
Player a;
bool SendEvent(int eventType);
};
class Sub: public Base
{
protected:
Player b;
bool Execute(string a);
};
}
ファイル #2
//class sef::Sub; // I am having trouble compiling this
class Player
{
public:
sef::Sub* engine; // I am having trouble compiling this
};
ファイル #2 で sef::Sub クラスを前方宣言するにはどうすればよいですか?