/********************************************************************************** *** FILE: movingobject.h *** DATE: Jan 14, 2004 *** AUTHOR: Daniel Dementiev *** GOAL: This is a eader file to illustrate separating a class definition into *** different files. *** Designed for IST482 class. **********************************************************************************/ #ifndef _MOVINGOBJECT_H #define _MOVINGOBJECT_H class MovingObject { public: enum Direction {North, West, South, East}; MovingObject(); int getX(); int getY(); void step(); void speed_up(); void slow_down(); void turn(Direction new_dir); private: int x, y; // current coordinates of the object Direction dir; // direction of the object int speed; // speed of the object }; inline int MovingObject::getX() { return x; } inline int MovingObject::getY() { return y; } inline void MovingObject::speed_up() { speed++; } inline void MovingObject::slow_down() { if( speed ) speed--; } inline void MovingObject::turn(Direction new_dir) { dir = new_dir; } #endif /* ****************************************************************************** */