$9.3.1/3 states-
"A nonstatic member function may be declared const, volatile, or const volatile. These cvqualifiers affect the type of the this pointer (9.3.2). They also affect the function type (8.3.5) of the member function; a member function declared const is a const member function, a member function declared volatile is a volatile member function and a member function declared const volatile is a const volatile member function."
So here is the summary:
a) A const qualifier can be used only for class non static member functions
b) cv qualification for function participate in overloading
struct X{
int x;
void f() const{
cout << typeid(this).name();
// this->x = 2; // error
}
void f(){
cout << typeid(this).name();
this->x = 2; // ok
}
};
int main(){
X x;
x.f(); // Calls non const version as const qualification is required
// to match parameter to argument for the const version
X const xc;
xc.f(); // Calls const version as this is an exact match (identity
// conversion)
}