Immutable object: Difference between revisions

Content deleted Content added
Line 109:
</syntaxhighlight>
 
Note that, if there were a fielddata member that is a pointer or reference to another object, then it might still beis possible to mutate the object pointed to byor suchreferenced a pointer or referenceonly within a non-const method, without violating const-correctness. It can be argued that in such a case the object is not really immutable.
 
C++ also provides abstract (as opposed to bitwise) immutability via the <code>mutable</code> keyword, which lets a [[member variable]] be changed from within a <code>const</code> method.