Constant Member Functions
- Keyword const may be applied to member functions (or member
operators)
- Meaning: the object will not be changed when that method
is invoked
- Enforced by the compiler
class IntArray
{
public:
size_t Size() const;
private:
size_t size_;
} ;
size_t IntArray::Size() const
{
return size_;
}
Const methods are distinct from non-const methods by the same name