title: how to adjust a c++ code to work with template class
body: <p>Following codes are part of a Red Black Tree program which has to take <code>item</code> as a char or int, so I decided to use a template class, however I don't know how to extend it through the complete program and the compiler sends me thousand errors:</p>
  
  <p>The code has German names, so if it makes it easier to understand, I will translate some of them:</p>
  
  <pre><code>baum = tree
  knote = node
  links = left
  rechts = right
  rot = red
  doppel = double
  mittlere = middle
  eltern = parent
  einfuegen = insert
  rs = rb = red black
  </code></pre>
  
  <p>Knote.hpp</p>
  
  <pre><code>#pragma once
  
  template &lt;class T&gt;
  class Knote {
  public:
      Knote(T data = 0);
      bool rot;
      T item;
      Knote *links;
      Knote *rechts;
      Knote *eltern;
  };
  </code></pre>
  
  <p>Knote.cpp</p>
  
  <pre><code>#include "Knote.hpp"
  
  Knote&lt;int&gt;::Knote(int data)
  {
      this-&gt;item = data;
  
      eltern = nullptr;
      links = nullptr;
      rechts = nullptr;
      rot = true;
  }
  </code></pre>
  
  <p>now how should I do it for the rest?</p>
  
  <p>Baum.hpp</p>
  
  <pre><code>#pragma once
  
  #include "Knote.hpp"
  
  #include &lt;vector&gt;
  
  class Baum
  {
  public:
      Baum();
      void einfuegen(int x);
      void ausgabe_levelorder();
      void ausgabe_inorder();
  private:
      Knote&lt;int&gt;* head;
      void rs_einfuegen(Knote&lt;int&gt;* &amp;knote, Knote&lt;int&gt;* &amp;eltern, int x, bool sw);
      int rot(Knote&lt;int&gt;* &amp;knote);
      void links_rotation(Knote&lt;int&gt; * &amp;links_knote);
      void rechts_rotation(Knote&lt;int&gt; * &amp;links_knote);
      void levelorder(Knote&lt;int&gt;* knote, std::vector&lt;Knote&lt;int&gt;*&gt; &amp;knoteQueue, int niveau, std::vector&lt;int&gt; &amp;niveauQueue);
      void sort_levelorder(std::vector&lt;Knote&lt;int&gt;*&gt; &amp;knoteQueue, std::vector&lt;int&gt; &amp;niveauQueue);
      void inorder(Knote&lt;int&gt;* knote);
  };
  </code></pre>
  
  <p>Baum.cpp</p>
  
  <pre><code>#include "Baum.hpp"
  
  #include &lt;iostream&gt;
  
  using namespace std;
  
  Baum::Baum()
  {
      ...
  }
  
  // XXX
  void Baum::einfuegen(int x)
  {
      ...
  }
  
  // XXX
  int Baum::rot(Knote&lt;int&gt;* &amp;knote)
  {
      ...
  }
  
  // XXX
  void Baum::rs_einfuegen(Knote&lt;int&gt; *&amp; knote, Knote&lt;int&gt; *&amp;eltern, int x, bool sw)
  {
      ...
  }
  
  // XXX
  void Baum::links_rotation(Knote&lt;int&gt;* &amp;links_knote)
  {
      ...
  }
  
  // XXX
  void Baum::rechts_rotation(Knote&lt;int&gt;* &amp;rechts_knote)
  {
      ...
  }
  
  // XXX
  void Baum::ausgabe_levelorder()
  {
      ...
  }
  
  // XXX
  void Baum::levelorder(Knote&lt;int&gt;* knote, vector&lt;Knote&lt;int&gt;*&gt; &amp;knoteQueue, int niveau, vector&lt;int&gt; &amp;niveauQueue)
  {
      ...
  }
  
  // XXX
  void Baum::sort_levelorder(vector&lt;Knote&lt;int&gt;*&gt; &amp;knoteQueue, vector&lt;int&gt; &amp;niveauQueue)
  {
      ...
  }
  
  // XXX
  void Baum::ausgabe_inorder()
  {
      inorder(head-&gt;rechts);
      cout &lt;&lt; endl;
  }
  
  // XXX
  void Baum::inorder(Knote&lt;int&gt;* knote)
  {
      if (knote != nullptr)
      {
          inorder(knote-&gt;links);
          cout &lt;&lt; knote-&gt;item &lt;&lt; " ";
          inorder(knote-&gt;rechts);
      }
  }
  </code></pre>