次の方法で共有


コンパイラ エラー C3901

'accessor_function': 戻り値の型 ''type' を指定しなければなりません

戻り値の型がプロパティの型と一致する get メソッドが少なくとも 1 つは必要です。 詳細については、「 property」を参照してください。

次の例では C3901 が生成されます。

// C3901.cpp
// compile with: /clr /c
using namespace System;
ref class X {
   property String^ Name {
      void get();   // C3901
      // try the following line instead
      // String^ get();
   };
};

ref class Y {
   property double values[int, int] {
      int get(int, int);   // C3901
      // try the following line instead
      // double get(int, int);
   };
};