title: Set default parameter to nullptr and non-static class fields in C++
body: <p>I am building a binary search tree and the following is the add function:</p>
  
  <pre><code>void BinaryTree::add(int value, Node*&amp; node, Node*&amp; parent) {
      if(!node) {
          node = new Node(value);
          node-&gt;parent = parent;
      }
      else if(node-&gt;key &lt; value)
          this-&gt;add(value, node-&gt;rightNode, node);
      else if(node-&gt;key &gt; value)
          this-&gt;add(value, node-&gt;leftNode, node);
  }
  </code></pre>
  
  <p>I want to set default parameters for the last two (node, parent) parameters:</p>
  
  <pre><code>void add(int value, Node*&amp; node = root , Node*&amp; parent = nullptr);
  </code></pre>
  
  <p>where root is a field of the class.</p>
  
  <p>This does not seem to work for either case. How shall I implement it and what is wrong here?
  Thanks!</p>