共用方式為


編譯器錯誤 C2394

'type::operator operator':CLR/WinRT 運算子無效。 至少一個參數必須是下列類型: 'T^', 'T^%', 'T^&',其中 T = 'type'

備註

Windows 執行階段或 Managed 類型中的運算子沒有至少一個參數,其類型與運算子傳回值的類型相同。

Example

下列範例會產生 C2394:

// C2394.cpp
// compile with: /clr /c
ref struct Y {
   static Y^ operator -(int i, char c);   // C2394

   // OK
   static Y^ operator -(Y^ hY, char c);
   // or
   static Y^ operator -(int i, Y^& rhY);
};