0
我有這個類:屬性使用在C私有方法++
class Size
{
private:
int size_x;
int size_y;
int GetX(void);
int GetY(void);
void PutX(int x);
void PutY(int y);
public:
_declspec (property (get = GetX , put = PutX)) int X;
_declspec (property (get = GetY , put = PutY)) int Y;
};
此代碼將無法正常工作,因爲當我嘗試訪問X或Y,使用私有方法。
我該如何製作一個使用無法在課堂外使用功能的屬性?
如果你只是讓這些功能可以用作存取?爲什麼不是一個解決方案? – 2013-03-24 13:15:41
這是什麼語言?它看起來不像C++。 – juanchopanza 2013-03-24 13:15:44
@ H2CO3你是指什麼訪問者?我不熟悉那個術語.. :) – 2013-03-24 13:17:31