title: C++ Template, learning for the first time, what is wrong with this code?
body: <p>I am learning C++ templates for the first time, and have copied this code from "Data Structures and Algorithms in C++ by Michael Goodrich."</p>
  
  <p>I get the error "Line 13: SLinkedList is not a template." I am at a complete loss as to why it is not since I have used "template " everywhere.</p>
  
  <pre><code>    // ------------------ DEFINITION FOR NODE ------------------------
  template &lt;typename E&gt;
  class SNode{
  
      private:
          E elem;
          SNode&lt;E&gt;* next;
  
  
          friend class SLinkedList&lt;E&gt;;
  
      public:
          SNode(E element = NULL);
          const E getElem() const;
          void setElem(E element);
  
  
  };
  
  template &lt;typename E&gt;
  SNode&lt;E&gt;::SNode(E element){ elem = element;}
  
  template &lt;typename E&gt;
  const E SNode&lt;E&gt;::getElem() const
      {return elem;}
  
  template &lt;typename E&gt;
  void SNode&lt;E&gt;::setElem(E element)
      {elem = element;}
  
  
  
  
  
  
  // -------------------- DEFINITION FOR SINGLY-LINKED LIST --------------
  template &lt;typename E&gt;
  class SLinkedList
  {
      private:
          SNode&lt;E&gt;* head;
  
      public:
          SLinkedList();
          ~SLinkedList();
          bool isempty() const;
          const E&amp; infront() const;
          void addfront(const E&amp; e);
          void removefront();
  
  
  };
  
  template &lt;typename E&gt;
  SLinkedList&lt;E&gt;::SLinkedList()
      :head(NULL) {}
  
  template &lt;typename E&gt;
  SLinkedList&lt;E&gt;::~SLinkedList()
      {while(!isempty()) removefront();}
  
  template &lt;typename E&gt;
  bool SLinkedList&lt;E&gt;::isempty() const
      {return (head == NULL);}
  
  template &lt;typename E&gt;
  const E&amp; SLinkedList&lt;E&gt;::infront() const {return head-&gt;elem;}
  
  template &lt;typename E&gt;
  void SLinkedList&lt;E&gt;::addfront(const E&amp; element) {
  
      SNode&lt;E&gt;* v = new SNode&lt;E&gt;;
      v-&gt;elem = element;
      v-&gt;next = head;
      head = v;
  }
  
  template &lt;typename E&gt;
  void SLinkedList&lt;E&gt;::removefront() {
      SNode&lt;E&gt;* old = head;
      head = old-&gt;next;
      delete old;
  
  }
  
  int main()
  {
  
  
      std::cout&lt;&lt;"Checking SLinkedList ..."&lt;&lt;std::endl&lt;&lt;std::endl;
  
  
      SLinkedList&lt;int&gt; intList;
      intList.addfront(13);
      std::cout&lt;&lt;intList.head-&gt;next-&gt;getElem();
  
  
      return 0;
  }
  </code></pre>