template typename1 template - class 내부 변수명을 명확히 하기 우선 소스를 보자. #include using namespace std; template class Movement { public: enum Direction { NOWHERE = 0, UP, DOWN, LEFT, RIGHT }; // end - enum Direction movingDirection_; StepType stepNo_; Direction whereToGo(void); }; // end - class template Movement::Direction Movement::whereToGo(void) { return movingDirection_; } 위의 클래스처럼 템플릿을 사용한 클래스를 생성할때, 클래스 안에 enum 이라던지 typedef 로 재정의한 클래스 내부 타입을 정의하곤 한다.. 2009. 2. 19. 이전 1 다음