title: Side Effect on Object Pointer
body: <p>i can get where the problem is in this snippet:</p>
  
  <p>I want to reset a pointer inside a function, I achieved to make it works by just returning the pointer, but I could not make it with side effect(passing by pointer).</p>
  
  <pre><code>void function(Object * obj)[{
      obj = new Object();
      cout &lt;&lt; obj &lt;&lt; endl;
      //return obj;
  }
  
  main(){
      Object * obj = 0;
      function(obj);
      cout &lt;&lt; obj &lt;&lt; endl;
  }
  </code></pre>
  
  <p>In this case the result is:</p>
  
  <pre><code>0x12345678
  0
  </code></pre>
  
  <p>while it was supposed to be </p>
  
  <pre><code>0x12345678
  0x12345678
  </code></pre>
  
  <p>I tried using either pointer of pointer or pointer of references but still could not get through the function. While just returning the value worked like a charm. But i need to do this on several params, and the code s much more complex than it appears here.</p>