Physical constness of a class
<p>I'm studying "The C++ Programming Language" from Bjarne Stroustrup and he talks about logical and physical constness of a class. </p>

<p>The example of logical constness is something like:</p>

<pre><code>class A {
    int m;
    void func() const { m++; } //forbidden
}
</code></pre>

<p>It's possible to bypass this with a cast, like:</p>

<pre><code>class A {
    int m;
    void func() const { (A*) this)-&gt;m++; } //allowed
}
</code></pre>

<p>In his words, logical constness is </p>

<blockquote>
  <p>"an object that appears constant to its users."</p>
</blockquote>

<p>and physical constness is</p>

<blockquote>
  <p>"stored in read-only memory"</p>
</blockquote>

<p>As a note he says that </p>

<blockquote>
  <p>physical constness may be enforced by placement of an object in read-only memory only for classes without constructors</p>
</blockquote>

<p>I didn't quite understand this statement. Could someone provide an explanation on how to enforce physical constness and why it does not work if the class has a constructor?</p>
