반응형 2016/09/251 2016-09-25_조재찬_스터디일지_CPP-정보은닉, const함수, 캡슐화 정보 은닉 (Information): 클래스의 멤버변수를 private로 선언, 해당 변수에 접근하는 함수를 별도로 정의해, 안전한 형태로 멤버 변수의 접근을 유도한다. Point 클래스의 정보은닉12345678910111213class Point{private: int x; int y; public: bool InitMembers(int xpos, int ypos); int GetX() const; int GetY() const; bool SetX(int xpos); bool SetY(int ypos);};Colored by Color Scriptercs8 행 : 벗어난 범위의 값 저장을 막는 초기화 함수9-12 행 : 정보 은닉으로 인해 추가되는 접근(access) 함수들 get은 값을 반환, set.. 2016. 9. 25. 이전 1 다음 728x90 반응형