共用方式為


編譯器錯誤 C2394

'your_type::operator'op'“ : CLR 或 WinRToperator 無效。 至少有一個參數必須是下列類型:'T^'、'T^%'、'T^&',其中 T = 'your_type'

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

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