When you have a const object, only member functions marked as const can be called. for example
struct Silly { void say_hi(); void say_bye() const; };
In addition, a constant member function cannot change any member variables of an object (unless member variables change), for example
struct Silly { int x; mutable int y; void do_stuff() const { x = 0; }
bstamour
source share