원문은 이곳에서..

다음은 header의 선언부.

using namespace System;
public ref class Test
{
    long mValue;
    array<long>^ mValues;
public:
    Test() {}
    property long noindex {
        void set(long);
        long get();
    }
    property long indexed[int] {
        void set(int,long);
        long get(int);
    }
};
C++

위 선언부에 대한 정의는..

long Test::noindex::get() { return mValue; }
void Test::noindex::set(long value) { mValue = 0; }
long Test::indexed::get(int index) { return mValues[index]; }
void Test::indexed::set(int index, long value)
{
    mValues[index] = value;
}
C++

Comments