You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// 점을 나타내는 클래스classPoint{
public:Point(int x, int y);
voidSetX(int newVal);
voidSetY(int newVal);
};
structRectData{
Point ulhc;
Point lrhc;
};
classRectangle{
public:Point& upperLeft() const {return pData->ulhc;} // Point 객체에 대한 참조자 반환Point& lowerRight() const {return pData->lrhc;} // Point 객체에 대한 참조자 반환private:
std::shared_ptr<RectData> pData;
};
const Rectangle rec(coord1, coord2);
rec.upperLeft().setX(50); // 상수객체의 값을 바꿀수 있다.