+19  A: 

const after a function declaration means that the function is not allowed to change any class members (except ones that are marked mutable). const in a function defintion means the same as const for a variable: that the value is not allowed to change.

const is a highly overloaded operator and the syntax is often not straightforward in combination with pointers. Some readings about const correctness and the const keyword:

Const correctness

The C++ 'const' Declaration: Why & How

+1 for speaking about `mutable` members.
+2  A: 

Similar to this question.

In essence it means that the method Bar will not modify non mutable member variables of Foo.

+5  A: 

Bar is guaranteed not to change the object it is being invoked on. See the section about const correctness in the C++ FAQ, for example.

Don't forget about `mutable` keyword.
Nikolai N Fetissov
+2  A: 

I always find it conceptually easier to think of that you are making the this pointer const (which is pretty much what it does).

Actually, not the `this` pointer itself is `const`, but what it points to, i.e. `*this` ;)
+2  A: 

Consider two class-typed variables:

class Boo { ... };

Boo b0;       // mutable object
const Boo b1; // non-mutable object

Now you are able to call any member function of Boo on b0, but only const-qualified member functions on b1.

Nikolai N Fetissov

Function can't change its parameters via the pointer/reference you gave it.

I go to this page every time I need to think about it:


I believe there's also a good chapter in Meyers' "More Effective C++".


It doesn't change. Ever.