次の方法で共有


コンパイラ エラー C2396

'your_type::operator'type'' : CLR または WinRT のユーザー定義された変換関数は無効です。 変換元または変換先: 'T^'、'T^%'、'T^>、T = 'your_type'

Windows ランタイム型またはマネージド型の変換関数に、変換関数が含まれる型と同じ型を持つ 1 つ以上のパラメーターがありません。

次の例では、C2396 を生成し、その修正方法を示しています。

// C2396.cpp
// compile with: /clr /c

ref struct Y {
   static operator int(char c);   // C2396

   // OK
   static operator int(Y^ hY);
   // or
   static operator Y^(char c);
};