title: functionname redefinition; different basic types
body: <p>I'm getting the following error: 
  error C2371: 'BinarySearchTree::isComplete' : redefinition; different basic types</p>
  
  <p>This is my header file:</p>
  
  <pre><code>    #ifndef BinarySearchTree_H
  #define BinarySearchTree_H
  
  #include &lt;iostream&gt;
  #include "Queue.h"
  #include &lt;cmath&gt;
  using namespace std;
  
  template &lt;class T&gt;
  struct TreeNode;
  
  enum OrderType {PRE_ORDER, IN_ORDER, POST_ORDER};
  
  template &lt;class T&gt;
  class BinarySearchTree
  {
  public:
    BinarySearchTree();                     // Constructor.
    ~BinarySearchTree();                    // Destructor.
    BinarySearchTree(const BinarySearchTree&amp; originalTree);  // Copy constructor.
    void operator=(const BinarySearchTree&amp; originalTree);
    void MakeEmpty();
    bool IsEmpty() const;
    bool IsFull() const;
    int LengthIs() const;
    void RetrieveItem(T&amp; item, bool&amp; found) const;
    void InsertItem(T item);
    void DeleteItem(T item);
    void ResetTree(OrderType order);
    void GetNextItem(T&amp; item, OrderType order,bool&amp; finished);
    void Print(std::ostream&amp; outFile, OrderType order) const;
    int countMaxDepth();
    void arrayBST(T * a);
    bool isComplete();
    bool isComplete(TreeNode* node);
  
  
  private:
    TreeNode&lt;T&gt;* root;
    Queue&lt;T&gt; preQue;
    Queue&lt;T&gt; inQue;
    Queue&lt;T&gt; postQue;
  
  };
  
  template &lt;class T&gt;
  int CountNodes(TreeNode&lt;T&gt;* tree);
  
  template &lt;class T&gt;
  void GetPredecessor(TreeNode&lt;T&gt;* tree, T&amp; data);
  
  template &lt;class T&gt;
  void Destroy(TreeNode&lt;T&gt;*&amp; tree);
  
  template &lt;class T&gt;
  void CopyTree(TreeNode&lt;T&gt;*&amp; copy, const TreeNode&lt;T&gt;* originalTree);
  
  template &lt;class T&gt;
  void PreOrder(TreeNode&lt;T&gt;*, Queue&lt;T&gt;&amp;);
  
  template &lt;class T&gt;
  void InOrder(TreeNode&lt;T&gt;*, Queue&lt;T&gt;&amp;);
  
  template &lt;class T&gt;
  void PostOrder(TreeNode&lt;T&gt;*, Queue&lt;T&gt;&amp;);
  
  template &lt;class T&gt;
  void PrintTree(TreeNode&lt;T&gt;* tree, std::ostream&amp; outFile);
  
  template &lt;class T&gt;
  int maxDepth(TreeNode&lt;T&gt;* tree);
  
  
  
  #endif
  </code></pre>
  
  <p>This is my implementation file:</p>
  
  <pre><code>    #include "BinarySearchTree.h"
  #include "Queue.h"
  #include "Queue.cpp"
  
  template &lt;class T&gt;
  struct TreeNode
  {
    T info;
    TreeNode&lt;T&gt;* left;
    TreeNode&lt;T&gt;* right;
  };
  
  template &lt;class T&gt;
  bool BinarySearchTree&lt;T&gt;::IsFull() const
  // Returns true if the free store has no room for another node
  //  and false otherwise.
  {
    TreeNode&lt;T&gt;* location;
    try
    {
      location = new TreeNode&lt;T&gt;;
      delete location;
      return false;
    }
    catch(std::bad_alloc exception)
    {
      return true;
    }
  }
  
  template &lt;class T&gt;
  bool BinarySearchTree&lt;T&gt;::IsEmpty() const
  // Returns true if the tree is empty and false otherwise.
  {
      return root == NULL;
  }
  
  template &lt;class T&gt;
  int BinarySearchTree&lt;T&gt;::LengthIs() const
  // Calls the recursive function CountNodes to count the
  //  nodes in the tree.
  {
    return CountNodes(root);
  }
  
  template &lt;class T&gt;
  int CountNodes(TreeNode&lt;T&gt;* tree)
  // Post: Returns the number of nodes in the tree.
  {
    if (tree == NULL)
      return 0;
    else
      return CountNodes(tree-&gt;left) + CountNodes(tree-&gt;right) + 1;
  }
  
  template &lt;class T&gt;
  void BinarySearchTree&lt;T&gt;::RetrieveItem(T&amp; item, bool&amp; found) const
  // Calls recursive function Retrieve to search the tree for item.
  {
    Retrieve(root, item, found);
  }
  
  template &lt;class T&gt;
  void Retrieve(TreeNode&lt;T&gt;* tree,
       T&amp; item, bool&amp; found)
  // Recursively searches tree for item.
  // Post: If there is an element someItem whose key matches item's,
  //       found is true and item is set to a copy of someItem;
  //       otherwise, found is false and item is unchanged.
  {
    if (tree == NULL)
      found = false;                      // item is not found.
    else if (item &lt; tree-&gt;info)
      Retrieve(tree-&gt;left, item, found); // Search left subtree.
    else if (item &gt; tree-&gt;info)
      Retrieve(tree-&gt;right, item, found);// Search right subtree.
    else
    {
      item = tree-&gt;info;                 // item is found.
      found = true;
    }
  }
  
  
  template &lt;class T&gt;
  void BinarySearchTree&lt;T&gt;::InsertItem(T item)
  // Calls the recursive function Insert to insert item into tree.
  {
    Insert(root, item);
  }
  
  template &lt;class T&gt;
  void Insert(TreeNode&lt;T&gt;*&amp; tree, T item)
  // Inserts item into tree.
  // Post: item is in tree; search property is maintained.
  {
    if (tree == NULL)
    {// Insertion place found.
      tree = new TreeNode&lt;T&gt;;
      tree-&gt;right = NULL;
      tree-&gt;left = NULL;
      tree-&gt;info = item;
    }
    else if (item &lt; tree-&gt;info)
      Insert(tree-&gt;left, item);     // Insert in left subtree.
    else
      Insert(tree-&gt;right, item);    // Insert in right subtree.
  }
  
  template &lt;class T&gt;
  void BinarySearchTree&lt;T&gt;::DeleteItem(T item)
  // Calls the recursive function Delete to delete item from tree.
  {
    Delete(root, item);
  }
  
  template &lt;class T&gt;
  void Delete(TreeNode&lt;T&gt;*&amp; tree, T item)
  // Deletes item from tree.
  // Post:  item is not in tree.
  {
    if (item &lt; tree-&gt;info)
      Delete(tree-&gt;left, item);    // Look in left subtree.
    else if (item &gt; tree-&gt;info)
      Delete(tree-&gt;right, item);   // Look in right subtree.
    else
      DeleteNode(tree);            // Node found; call DeleteNode.
  }
  
  template &lt;class T&gt;
  void DeleteNode(TreeNode&lt;T&gt;*&amp; tree)
  // Deletes the node pointed to by tree.
  // Post: The user's data in the node pointed to by tree is no
  //       longer in the tree.  If tree is a leaf node or has only one
  //       non-NULL child pointer, the node pointed to by tree is
  //       deleted; otherwise, the user's data is replaced by its
  //       logical predecessor and the predecessor's node is deleted.
  {
    T data;
    TreeNode&lt;T&gt;* tempPtr;
  
    tempPtr = tree;
    if (tree-&gt;left == NULL)
    {
      tree = tree-&gt;right;
      delete tempPtr;
    }
    else if (tree-&gt;right == NULL)
    {
      tree = tree-&gt;left;
      delete tempPtr;
    }
    else
    {
      GetPredecessor(tree-&gt;left, data);
      tree-&gt;info = data;
      Delete(tree-&gt;left, data);  // Delete predecessor node.
    }
  }
  
  template &lt;class T&gt;
  void GetPredecessor(TreeNode&lt;T&gt;* tree, T&amp; data)
  // Sets data to the info member of the rightmost node in tree.
  {
    while (tree-&gt;right != NULL)
      tree = tree-&gt;right;
    data = tree-&gt;info;
  }
  
  template &lt;class T&gt;
  BinarySearchTree&lt;T&gt;::BinarySearchTree()
  {
    root = NULL;
  }
  
  template &lt;class T&gt;
  BinarySearchTree&lt;T&gt;::~BinarySearchTree()
  // Calls recursive function Destroy to destroy the tree.
  {
    Destroy(root);
  }
  
  template &lt;class T&gt;
  void Destroy(TreeNode&lt;T&gt;*&amp; tree)
  // Post: tree is empty; nodes have been deallocated.
  {
    if (tree != NULL)
    {
      Destroy(tree-&gt;left);
      Destroy(tree-&gt;right);
      delete tree;
    }
  }
  
  template &lt;class T&gt;
  BinarySearchTree&lt;T&gt;::BinarySearchTree(const BinarySearchTree&lt;T&gt;&amp; originalTree)
  // Calls the recursive function CopyTree to copy originalTree
  //  into root.
  {
    CopyTree(root, originalTree.root);
  }
  
  template &lt;class T&gt;
  void BinarySearchTree&lt;T&gt;::operator=
       (const BinarySearchTree&lt;T&gt;&amp; originalTree)
  // Calls the recursive function CopyTree to copy originalTree
  // into root.
  {
    {
      if (&amp;originalTree == this)
        return;              // Ignore assigning self to self.
      Destroy(root);         // Deallocate existing tree nodes.
      CopyTree(root, originalTree.root);
    }
  }
  
  template &lt;class T&gt;
  void CopyTree(TreeNode&lt;T&gt;*&amp; copy,
       const TreeNode&lt;T&gt;* originalTree)
  // Post: copy is the root of a tree that is a duplicate
  //       of originalTree.
  {
    if (originalTree == NULL)
      copy = NULL;
    else
    {
      copy = new TreeNode&lt;T&gt;;
      copy-&gt;info = originalTree-&gt;info;
      CopyTree(copy-&gt;left, originalTree-&gt;left);
      CopyTree(copy-&gt;right, originalTree-&gt;right);
    }
  }
  
  template &lt;class T&gt;
  void BinarySearchTree&lt;T&gt;::ResetTree(OrderType order)
  // Calls a function to create a queue of the tree elements in
  // the desired order.
  {
    switch (order)
    {
      case PRE_ORDER : PreOrder(root, preQue);
                       break;
      case IN_ORDER  : InOrder(root, inQue);
                       break;
      case POST_ORDER: PostOrder(root, postQue);
                       break;
    }
  }
  
  template &lt;class T&gt;
  void PreOrder(TreeNode&lt;T&gt;* tree,
       Queue&lt;T&gt;&amp; preQue)
  // Post: preQue contains the tree items in preorder.
  {
    if (tree != NULL)
    {
      preQue.Enqueue(tree-&gt;info);
      PreOrder(tree-&gt;left, preQue);
      PreOrder(tree-&gt;right, preQue);
    }
  }
  
  template &lt;class T&gt;
  void InOrder(TreeNode&lt;T&gt;* tree, Queue&lt;T&gt;&amp; inQue)
  // Post: inQue contains the tree items in inorder.
  {
    if (tree != NULL)
    {
      InOrder(tree-&gt;left, inQue);
      inQue.Enqueue(tree-&gt;info);
      InOrder(tree-&gt;right, inQue);
    }
  }
  
  template &lt;class T&gt;
  void PostOrder(TreeNode&lt;T&gt;* tree,
       Queue&lt;T&gt;&amp; postQue)
  // Post: postQue contains the tree items in postorder.
  {
    if (tree != NULL)
    {
      PostOrder(tree-&gt;left, postQue);
      PostOrder(tree-&gt;right, postQue);
      postQue.Enqueue(tree-&gt;info);
    }
  }
  
  template &lt;class T&gt;
  void BinarySearchTree&lt;T&gt;::GetNextItem(T&amp; item,
       OrderType order, bool&amp; finished)
  // Returns the next item in the desired order.
  // Post: For the desired order, item is the next item in the queue.
  //       If item is the last one in the queue, finished is true;
  //       otherwise, finished is false.
  {
    finished = false;
    switch (order)
    {
      case PRE_ORDER  : preQue.Dequeue(item);
                        if (preQue.IsEmpty())
                          finished = true;
                        break;
      case IN_ORDER   : inQue.Dequeue(item);
                        if (inQue.IsEmpty())
                         finished = true;
                       break;
      case POST_ORDER: postQue.Dequeue(item);
                       if (postQue.IsEmpty())
                         finished = true;
                       break;
    }
  }
  
  template &lt;class T&gt;
  void PrintTree(TreeNode&lt;T&gt;* tree, std::ostream&amp; outFile, OrderType order)
  // Prints info member of items in tree in sorted order on outFile.
  {
      switch (order)
      {
      case PRE_ORDER :
          if (tree != NULL)
          {
              outFile &lt;&lt; tree-&gt;info;
              PrintTree(tree-&gt;left, outFile ,order);   // Print left subtree.
              PrintTree(tree-&gt;right, outFile, order);  // Print right subtree.
          }
          break;
      case IN_ORDER :
          if (tree != NULL)
          {
  
              PrintTree(tree-&gt;left, outFile, order);   // Print left subtree.
              outFile &lt;&lt; tree-&gt;info;
              PrintTree(tree-&gt;right, outFile, order);  // Print right subtree.
          }
          break;
      case POST_ORDER :
          if (tree != NULL)
          {
  
              PrintTree(tree-&gt;left, outFile, order);   // Print left subtree.
              PrintTree(tree-&gt;right, outFile, order);  // Print right subtree.
              outFile &lt;&lt; tree-&gt;info;
          }
          break;
      default:;
      }
  
  }
  
  template &lt;class T&gt;
  void BinarySearchTree&lt;T&gt;::Print(std::ostream&amp; outFile, OrderType order) const
  // Calls recursive function Print to print items in the tree.
  {
    PrintTree(root, outFile, order);
    outFile &lt;&lt; endl;
   }
  
  template &lt;class T&gt;
  int BinarySearchTree&lt;T&gt;::countMaxDepth()
  {
      return maxDepth(root)-1;
  }
  
  template &lt;class T&gt;
  int maxDepth(TreeNode&lt;T&gt;* tree)
  {
      if(tree == NULL)
          return 0;
      else
      {
          int lDepth = maxDepth(tree-&gt;left);
          int rDepth = maxDepth(tree-&gt;right);
          if(lDepth &gt; rDepth )
              return lDepth+1;
          else 
              return rDepth+1;
      }
  
  }
  
  template &lt;class T&gt;
  void BinarySearchTree&lt;T&gt;::arrayBST(T * a)
  {
      T temp;
      bool f;
      a = new T(CountNodes(root));
      ResetTree(IN_ORDER);
      for (int i = 0; i &lt; LengthIs(); i++)
      {
          GetNextItem(temp, IN_ORDER, f);
          a[i] = temp;
      }
  }
  
  template &lt;class T&gt;
  bool BinarySearchTree&lt;T&gt;::isComplete()
  {
      return isComplete(root);
  }
  
  template &lt;class T&gt;
  bool BinarySearchTree&lt;T&gt;::isComplete(TreeNode&lt;T&gt;* node)
  {
      if (node == NULL)
          return true;
      if ((node-&gt;left == NULL &amp;&amp; node-&gt;right != NULL) || (node-&gt;left != NULL &amp;&amp; node-&gt;right == NULL))
          return false;
      return isComplete(node-&gt;left) &amp;&amp; isComplete(node-&gt;right);
  }
  </code></pre>
  
  <p>I've done some googling but it's been no use. Does anyone know what the problem is?</p>