title: Delete pointer and object
body: <p>How do I delete a pointer and the object it's pointing to?</p>
  
  <p>Will the code below delete the object?</p>
  
  <pre><code>Object *apple;
  apple = new Object();
  
  delete apple;
  </code></pre>
  
  <p>And what happens if the pointer is not deleted, and gets out of scope?</p>
  
  <pre><code>Object *apple;
  apple = new Object();
  </code></pre>
  
  <p>This might be a very basic question, but I'm coming from Java.</p>