![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Abstraction Mechanisms, Part 1 - slide 23 : 36 |
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
![]() | A variant of Point with cached polar representation. |
![]() | The implementation of class Point - with compilation problems. |
![]() | A simple client program of Point. |
![]() | 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