next up previous contents
Next: It is about as Up: Using const Previous: Using const   Contents

What does const mean when it's on the right-hand side of a class member function declaration?

Technically, it defines the function to be a constant function. In as simple terms as we can explain, when C++ gets converted to C (C++ is simply a pre-processor for C you may recall), the const on the right side gets placed in front of the this pointer.

Accordingly, the function declarations:
11#11

Get converted into something like:


12#12

Thus, inside a const function the this pointer is declared as const so the calling object cannot be changed.



Falko Kuester 2001-08-24