title: errors trying to copy a binary search tree
body: <p>this is my copy constructor, overloaded assignment operator, and copy function, does anyone know why these 3 aren't working correctly?</p>
  
  <p><strong>copy function:</strong></p>
  
  <pre><code>template &lt;class T&gt;
  void BSTType&lt;T&gt;::copy(BTNodeType&lt;T&gt;*&amp; node1, BTNodeType&lt;T&gt;* node2){
      if(node2==NULL)
          node1=NULL;
      else{
          node1=new BTNodeType&lt;T&gt;;
          node1-&gt;item=node2-&gt;item;
          copy(node1-&gt;left, node2-&gt;left);
          copy(node1-&gt;right, node2-&gt;right);
      }
  }
  </code></pre>
  
  <p><strong>copy constructor that calls the copy function:</strong></p>
  
  <pre><code>template &lt;class T&gt;
  BSTType&lt;T&gt;::BSTType(const BSTType&lt;T&gt;&amp; tree){
      if(tree.root==NULL)
          root=NULL;
      else{
          copy(root, tree.root);
      }
  }
  </code></pre>
  
  <p><strong>overloaded assignment operator which also calls the copy function:</strong></p>
  
  <pre><code>template &lt;class T&gt;
  const BSTType&lt;T&gt;&amp; BSTType&lt;T&gt;::operator=(const BSTType&lt;T&gt;&amp; tree){
      if(this!=&amp;tree){
          if(root!=NULL)
              destroy(root);
          if(tree.root==NULL)
              root=NULL;
          else
              copy(root, tree.root);
      }
      return *this;
  }
  </code></pre>