title: Does a C++ style cast operator change the pointer it casts?
body: <p>I am quite happy using the C++ style casting operators within my code but I cannot say that I <strong>truly</strong> understand what goes on behind the scenes. I am basically wondering what actually is happening to the pointer during the following short process:</p>
  
  <pre><code>class A {};
  class B : public A {};
  class C : public B {};
  
  A* pC = new C();
  
  B* b = static_cast&lt;B*&gt;(pC);    // Is the value of pC changed by the cast?
  C* c = static_cast&lt;B*&gt;(pC);    // Is the value of pC changed by the cast?
  B* b2 = static_cast&lt;B*&gt;(c)     // Is the value of c now equal to the value of b2?
  </code></pre>
  
  <p>I realise that the object pointed to by <code>pC</code> is always of type <code>C</code> but after the first cast is made, I assume that the address stored in <code>b</code> is no longer equal to that of <code>pC</code>. But if the cast changes the value of <code>pC</code> my assumption is wrong. In a nutshell, can the cast operators actually change the address of the pointer they cast? This may seem a pretty facile question, but in my mind the picture is just not clear of how objects with an inheritance hierarchy are stored within memory and how the pointers get manipulated via the casts.</p>
  
  <p>In my head the value of <code>pC</code> remains unchanged no matter how many casts are performed on it but is this thinking correct?</p>