| 112 | |
| 113 | === Make use of declaring member variables and functions const === #code-good-bad-const-members |
| 114 | |
| 115 | We want to have a clean interface. Hence, it is vital to state in the interface that a function does not change the internal state of a class instance. If so, make it __const__. |
| 116 | |
| 117 | The same holds for variables. If they are set in the constructor and only read afterwards, make them __const__. |
| 118 | |
| 119 | ''Note: const variables are tricky with [http://www.boost.org/libs/serialization serialization], but in this specific case it is allowed to use '''const_cast<>()''' to allow writing a const member variable outside the constructor.'' |