double const in a definition

Hello,
if function is defined similar to this:
const_reference operator[] ( size_type n ) const;,
Why is const often used on both sides of function "header"?
the first const says that the return type is a constant and the second one says that the function is not going to change any of the member variables of the class. It is a way of secure programming and increases readability.
thanks.
Topic archived. No new replies allowed.