共用方式為


編譯器錯誤 C2514

'class' : 類別沒有建構函式

備註

類別、結構或等位沒有任何建構函式具有符合用來具現化參數的參數清單的建構函式。

類別必須先完整宣告,才能具現化。

Example

下列範例會產生 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
   }
};