Call a Function Also in the Class

So apparently I need to call the checkRange function for each set function.

Which of the following is correct? Or is neither correct? How do I call a function in a class (both the function below and the function being called in that function are in the same class)

Basically the function I am calling either returns either the value itself or the value closest that is in range

1
2
3
void Point::setX(int xVal) {
		x = (checkRange(xVal));
	}


1
2
3
4
5
void Point::setX(int xVal) {
	x = (Point::checkRange(xVal));
	
}
Last edited on
Either will work. The Point:: in the second snippet is generally considered unnecessary as are the extra ().
Topic archived. No new replies allowed.