I have a class for storing the position of an object in 2d, and I have to do some checking before a value is assign to the X and Y.
Should the "checkRange()" function be inline?
Code:class Position { public: Position(int nx, int ny); void setPos(int nx, int ny); private: int x,y; }; void Point::setPos(int nx, int ny) { x = nx; checkRange(0,50,nx); y = ny; checkRange(0,100,ny); } void checkRange(int min, int max, int &value) { if(value > max) value = max; if(value < min) value = min; }