Share via


編譯器錯誤 C2524

'destructor' : 解構函式/完成項必須具有 'void' 參數清單

解構函式具有不是 void 的參數清單。 不允許有其他的參數型別。

範例

下列程式碼會重現 C2524。

// C2524.cpp
// compile with: /c
class A {
   A() {}
   ~A(int i) {}    // C2524
   // try the following line instead
   // ~A() {}
};

下列程式碼會重現 C2524。

// C2524_b.cpp
// compile with: /clr /c
ref struct I1 {
protected:
   !I1(int i);   // C2524
   // try the following line instead
   // !I1();
};