If you declare a member function to be constant with the
const keyword, it indicates that the function won’t change the value of any members of the class. To declare a function as constant, put the keyword
const after the parentheses, as in this example:
void displayPage() const;
Accessors used to retrieve a variable’s value, which also are called getter functions, often are constant functions. The
Tricycle class from the preceding hour has two accessors:
void setSpeed(int newSpeed);int getSpeed(); ...