title: C++ <type>*& in class function or struct error
body: <p>Here is a part of my code:</p>
  
  <pre><code>class Node{
     public:
     Node* parent;
     Node* left;
     Node* right;
     int key;
  };
  
  (...)
  
  /*
  * Ps.: v1 is parent of v2!
  * and assume that v1-&gt;parent is NULL
  */
  void somefunction(Node*&amp; v1,Node*&amp; v2){
      (...)
      v2-&gt;parent = v1-&gt;parent; // The problem is here, more details below
      (...)
  }
  </code></pre>
  
  <p>The problem is when I call <code>v2-&gt;parent</code>, because of the <code>&lt;type&gt;*&amp;</code> in the argument of <code>somefunction()</code>, the compiler interprets that <code>v2-&gt;parent</code> is equal <code>v1</code> (who is v2's father), and it modifies <code>v1</code> to <code>NULL</code>, but I just want modify <code>v2-&gt;parent</code> value and not <code>v1</code>. </p>
  
  <p>PS.: I need to use <code>&lt;type&gt;*&amp;</code> in some parts below my code, I can't just modify the argument type.</p>