編譯器錯誤 C2514
'class' : 類別沒有建構函式
類別、結構或等位沒有建構函式,其參數清單和用來執行個體化的參數相符。
類別必須完整宣告,才能具現化。
下列範例會產生 C2514:
// C2514.cpp
// compile with: /c
class f;
class g {
public:
g (int x);
};
class fmaker {
f *func1() {
return new f(2); // C2514
}
g *func2() {
return new g(2); // OK
}
};