I am revisiting C++. I am confused about a syntax. It is not giving me any error but I don't understand how it works.
class Car {
private:
int wheels;
public:
void setWheels(const int numberOfWheels);
int getWheels() const;
};
void Car::setWheels(int numberOfWheels) {
wheels = numberOfWheels;
}
int Car::getWheels() const {
return wheels;
}
What does const do when it is put after the method name? Shouldn't it be put before the return type of the method?