title: constructors not allowed a return type (Generic Linked List)
body: <p>I am trying to make a Generic Linked list in C++ using templates. But i am getting this error 'GenericNode::{ctor}': constructors not allowed a return type through which i can't possibly know what am i doing wrong?
  PS. i have also gone through other posts here on Stack Overflow which says that the error is due to the missing semi-colon after the class definition but i think i don't have a 'missing semi-colon' case. Any help?</p>
  
  <p>Code :</p>
  
  <p>GenericLinkedList.h :</p>
  
  <pre><code>#pragma once
  
  template &lt;typename Datatype&gt;
  class GenericNode {
      Datatype T;
      GenericNode *next;
  
  public:
  
      GenericNode() {}
  
      GenericNode(Datatype T);
  
  };
  
  template&lt;typename Datatype&gt;
  void GenericNode&lt;Datatype&gt;::GenericNode(Datatype data) {
      T = data;
  }
  
  template &lt;typename Datatype&gt;
  class GenericLinkedList {
  
      GenericNode *Data;
  
  public:
  
      GenericLinkedList() {
          Data = NULL;
      }
  
      int isEmpty();
      void addDataAtFront(Datatype data);
      void addDataAtEnd(Datatype data);
      void print();
  
  };
  
  template &lt;typename Datatype&gt;
  int GenericLinkedList&lt;Datatype&gt;::isEmpty() {
      return Data == NULL;
  }
  
  template &lt;typename Datatype&gt;
  void GenericLinkedList&lt;Datatype&gt;::addDataAtFront(Datatype data) {
      GenericNode *newNode, *tmpNode;
      newNode = new Node;
      newNode-&gt;T = data;
      newNode-&gt;next = NULL;
  
      if (Data == NULL) {
          Data = newNode;
      }
  
      else {
          tmpNode = Data;
          Data = newNode;
          Data-&gt;next = tmpNode;
  
      }
  
  }
  
  template &lt;typename Datatype&gt;
  void GenericLinkedList&lt;Datatype&gt;::addDataAtEnd(Datatype data) {
      GenericNode *newNode, *tmpNode;
      newNode = new Node;
      newNode-&gt;T = data;
      newNode-&gt;next = NULL;
  
      if (Data == NULL) {
          Data = newNode;
      }
  
      else {
          tmpNode = Data;
          while (tmpNode-&gt;next != NULL) {
              tmpNode = tmpNode-&gt;next;
          }
  
          tmpNode-&gt;next = newNode;
  
      }
  
  }
  
  template &lt;typename Datatype&gt;
  void GenericLinkedList&lt;Datatype&gt;::print() {
      GenericNode tmpNode;
      tmpNode = Data;
      for (tmpNode;tmpNode != NULL;tmpNode = tmpNode-&gt;next) {
          cout &lt;&lt; tmpNode-&gt;T &lt;&lt; " ";
      }
  }
  </code></pre>
  
  <p>.cpp :</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;conio.h&gt;
  #include "GenericLinkedList.h"
  using namespace std;
  
  int main() {
  
      GenericLinkedList&lt;int&gt; T;
      T.addDataAtFront(5);
      T.addDataAtEnd(6);
      T.addDataAtFront(4);
      T.print();
  
      _getch();
  }
  </code></pre>