title: new operator in function parameter
body: <p>I have a function and that function takes in a class pointer. the problem is that I call the class pointer like this. </p>
  
  <pre><code>Function (new ChildClass);
  </code></pre>
  
  <p>the function looks something like this </p>
  
  <pre><code>void Function (BaseClass *instance)
  {
      childClassInstance = instance;
  }
  </code></pre>
  
  <p>the reason why I call it with the new keyword is because I need it outside my function. What I wanted to know was. When I'm ready to delete instance. How would I go about it? Since it's in the function parameter, how would I go about calling it in order to delete it? or how would I be able to access it's location in memory to be able to delete it?</p>
  
  <p>If this is not possible what would be a better solution?</p>