Lecture overview -- Keyboard shortcut: 'u'  Previous page: Const member functions -- Keyboard shortcut: 'p'  Next page: Object Self-reference -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Abstraction Mechanisms, Part 1 - slide 23 : 36

Const member functions - const and mutable

A member function may be logically constant, but the underlying state of the object may be physically non-constant (mutable)

It is possible to mark a data members as mutable

Mutable members can always be updated, even if they belong to a const object

point.h
A variant of Point with cached polar representation.
point.cc
The implementation of class Point - with compilation problems.
prog.cc
A simple client program of Point.
program-output
Program output.

The problem is that const member functions are not allowed to modify the caching variables.

In the next version - on the following page - we show how to deal with this problem