title: C++ using *new class, lost pointer?
body: <p>Curious as to why this fails. In the case where an object is returned rather than the pointer itself from using new, why is it illegal to make a pointer afterwards followed by deleting the pointer. Am I misunderstanding something with this sequence?</p>
  
  <p>e.g. </p>
  
  <pre><code>Example e = *new Example();      //dereferencing the pointer to get Example object
  Example* g = &amp;e;                 //pointer pointing to e's address
  delete g;                        //g is still pointer, but errors here.
  </code></pre>