title: Why I am getting visual studio C++ errors while trying Template
body: <p>The code compiles correctly. Then I get these Build errors when I try to run</p>
  
  <blockquote>
  <pre><code>Error C2955   'Node': use of class template requires template argument list.
  Error C2514   'Node': class has no constructors
  </code></pre>
  </blockquote>
  
  <p>I do not know much about template so correct me wherever I am wrong.
  So the code below is  my header file</p>
  
  <pre><code>#pragma once
  #include&lt;iostream&gt;
  using namespace std;
  template&lt;class T&gt;
      class Node
      {
      public:
          Node *left, *right, *parent;
          T key;
          Node(){
              left = right = parent = NULL;
          }
      };
  template&lt;class T&gt;
      class GenericBst {
          Node&lt;T&gt;* root;
          bool search(Node&lt;T&gt;* current, int value);//Finds a value is present
      public:
          GenericBst()
          {
              root = NULL;
          }
          void insertNode(int value);//Insertation of node
          bool search(int value);
      };
  
      template&lt;class T&gt;
      inline bool GenericBst&lt;T&gt;::search(Node&lt;T&gt;* current, int value)
      {
          if (current == NULL)
              return false;
          while (current != NULL)
          {
              if (current-&gt;key == value)
                  return true;
              else
              {
                  if (value &lt; current-&gt;key)
                      current = current-&gt;left;
                  else
                      current = current-&gt;right;
              }
          }
      }
  
      template&lt;class T&gt;
      inline void GenericBst&lt;T&gt;::insertNode(int value)
      {       
          Node&lt;T&gt;*temp = new Node();
          temp-&gt;key = value;
  
          Node&lt;T&gt; *current = root, *parent = NULL;
  
          while (current != NULL)
          {
              //Parent is assigned the current position and current goes to the child
              parent = current;
              if (value &lt; current-&gt;key)
              {
                  current = current-&gt;left;
              }
              else
              {
                  current = current-&gt;right;
              }
          }
          //Now we check if parent of current is NULL then currnt node is at root
          if (parent == NULL)
          {
              root = temp;//temp was used to store the insertion value. Now root points to it.
          }
          else if (value &lt; parent-&gt;key)
          {
              parent-&gt;left = temp;
          }
          else
          {
              parent-&gt;right = temp;
  
          }
          temp-&gt;parent = parent;
      }
  
      template&lt;class T&gt;
      inline bool GenericBst&lt;T&gt;::search(int value)
      {
          return search(root,value);
      }
  </code></pre>
  
  <p>The main class has</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  #include "GenericBst.h"
  #include &lt;iostream&gt;
  
  int main()
  {
      GenericBst&lt;int&gt; Obj;
      //GenericBst&lt;string&gt; Obj;
      std::cout &lt;&lt; "Welcome to generic World\n";
      int i = 1;
      int value;
      while (i != 0)
      {
          cout &lt;&lt; "\nSelect:\n\t1. Insert a node.\t2. Search a Node\n\t0. Quit" &lt;&lt; endl;
          switch (i)
          {
          case 0:
              i = 0;
              cout &lt;&lt; "\n\t\tBye\n";
              break;
          case 1:
              cout &lt;&lt; "Enter value: ";
              cin &gt;&gt; value;
              Obj.insertNode(value);
              break;
          case 2:
              cout &lt;&lt; "Enter value: ";
              cin &gt;&gt; value;
              cout &lt;&lt; Obj.search(value);
              break;
          }
      }
  }
  </code></pre>