The non-static member function, in addition to the parameters explicitly indicated in parentheses, also takes an implicit pointer this . Those. a pointer to an instance of the object on which this function was called.
If const not specified after the parameter list, this is of type X* const , i.e. pointer, which can not be changed, but the object itself can be changed through this pointer.
But when const present, the type of this becomes const X* const , i.e. a ban on attempts to change an object through this pointer is added.
The presence of const for a particular parameter of a function indicates that it is not this parameter that can be changed. For other parameters, their own limitations will apply.
In general, adding const where the object is not supposed to change allows you to write more reliable and understandable code, i.e. You can not accidentally change the object, which according to the logic of the developer should not change. If you try to change such an object, the compiler will generate an error.
On the topic of const we can remind about the existence of the mutable keyword, whose presence in the member of the object allows changing this member even if the function of the object was called const .