mutable

프로그래밍 2010. 10. 20. 22:19


#include <Turboc.h>

 

class Position

{

private:

     int x,y;

     char ch;

     mutable char info[256];

 

public:

     Position(int ax, int ay, char ach) { x=ax;y=ay;ch=ach; }

     void OutPosition() const { gotoxy(x, y);putch(ch); }

     void MoveTo(int ax, int ay) { x=ax; y=ay; }

     void MakeInfo() const { sprintf(info,"x=%d, y=%d, ch=%c",x,y,ch); }

     void OutInfo() const { puts(info); }

};

 

void main()

{

     const Position Here(11,22,'Z');

     Here.MakeInfo();

     Here.OutInfo();

}

 

 

Const 효과를 없에는 특정 변수설정

'프로그래밍' 카테고리의 다른 글

비주얼 스튜디오 링크 순서 보이기  (0) 2011.08.09
VS2008 컴파일러 옵션  (1) 2010.10.21
explicit  (0) 2010.10.20
ms vs에서 포인터 변수에 들어가있는 값의 비밀  (0) 2010.08.18
API 파일 처리 유용함수  (0) 2010.08.10