title: Converting a C++ class to a template class
body: <p>I just finished creating my binary tree class only to realise that I was supposed to make it as a template. I've spent hours now trying to get to convert it to a template, but I keep getting a multitude of errors ranging from "invalid use of template-name" to "extra qualification of a member". I am new to the concept of templates but I have an idea of what I'm trying to achieve. </p>
  
  <p>BTree.cpp
  </p>
  
  
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include "BTree.h"
  using namespace std;
  
  BTree::BTree(board startboard, string startplayer)
      {
      treeboard = startboard;
      player = startplayer;
      root = new BTNode(treeboard, player,-1,-1);
      }
  
  
  BTree::~BTree()
      {
      delete root;
      }
  
  int BTree::sumtree()
      {
      if (root-&gt;getvalue(-1) &gt; root-&gt;getvalue(1))
          return root-&gt;getchildposition(-1);
      else
          return root-&gt;getchildposition(1);
      }
  </code></pre>
  
  
  
  <p>BTree.h</p>
  
  
  
  <pre class="lang-c++ prettyprint-override"><code>#include &lt;string&gt;
  #include "BTNode.h"
  #include "board.h"
  using namespace std;
  class BTree
  {
  public:
      BTree(board startboard, string startplayer);
      ~BTree();
      int sumtree();
  
  private:
      string player;
      board treeboard;
      BTNode *root;
  };
  </code></pre>
  
  
  
  <p>'startplayer' is currently a string, I would like this to be the generic template type.</p>
  
  <p>What should my process be for turning this into a single template file?</p>