title: How to define a final variable (mutable constant) in C++?
body: <p>How do I define a constant in C++, that points to a mutable object?</p>
  
  <p>If I declare</p>
  
  <pre><code>static const CMyClass* IMPL;
  </code></pre>
  
  <p>and assign</p>
  
  <pre><code>const CMyClass* CSomeClass::IMPL = new CMyClass;
  </code></pre>
  
  <p>then I can only call <code>const</code> functions on the object. Its internals are locked. This is not what I want.</p>
  
  <p>If I leave off the <code>const</code> qualifier, I can reassign the pointer <code>IMPL</code>, so it isn’t protected as a constant anymore, which it should be. <code>final</code> seems to be applicable only to functions in C++. Is there an equivalent to a Java’s <code>final</code> variables in C++?</p>