Teilen über


Compilerfehler C2581

'type' : Static 'operator =' function is illegal

Bemerkungen

Der Zuordnungsoperator (=) wird fälschlicherweise als staticdeklariert. Zuordnungsoperatoren können nicht sein static. Weitere Informationen finden Sie unter User-Defined Operators (C++/CLI).For more information, see User-Defined Operators (C++/CLI).

Beispiel

Im folgenden Beispiel wird C2581 generiert.

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