title: Passing a class object pointer to a function for initialization C++
body: <p>Lets say I have a class "A" and this function:</p>
  
  <pre><code>void initializationFunction(A* classPointer)
  {
      ...
      ...
      classPointer = new A(.....); 
  }
  </code></pre>
  
  <p>I write:</p>
  
  <pre><code>A* classPointer;
  </code></pre>
  
  <p>Then I pass this pointer to this function:</p>
  
  <pre><code>initializationFunction(classPointer);
  </code></pre>
  
  <p>This will not work unless I pass it by reference in the function declaration:</p>
  
  <pre><code>void initializationFunction(A*&amp; classPointer);
  </code></pre>
  
  <p>I thought reference passing was for non-pointer type variables. I mean you don't need to pass an array by reference...</p>
  
  <p>Thanks for the explanations :)</p>