ここでNoobの質問。循環依存関係を持つクラスがあるため、それを前方宣言しました。今、私はこれでテンプレートを試してみることを計画しています.
//インチ
class C {
public:
virtual void getMap();
}
//ああで
class C;
class A {
public:
virtual void foo(C *c);
template <class T>
void changeProperty(C *c, string& s) {
void* obj = c->getMap()->at(s); // does not compile
// (did not include the rest for brevity)
}
}
これは、クラス C に関数「getMap()」がないことを示す指定された行でコンパイルに失敗します。これは修正できますか?もしそうなら、どのように?