What's the difference between having a const function and declaring const after the function? For example, if I had a class Myclass with some private data members and I set up a public function called int getMyValue(), what would the difference be between declaring that function as:

const int getMyValue();


int getMyValue() const;

The first example associates the const-ness with the value returned from the call. In the second example you are specifying that the call can not modify the object being invoked.