Share via


編譯器錯誤 C2581

'type' : 靜態 'operator =' 函式不合法

指派 (Assignment,=) 運算子宣告為 static 不正確。 指派運算子不可以是 static。 如需詳細資訊,請參閱使用者定義運算子

範例

下列範例會產生 C2581。

// C2581.cpp
// compile with: /clr /c
ref struct Y {
   static Y ^ operator = (Y^ me, int i);   // C2581
   Y^ operator =(int i);   // OK
};