title: Creating Linked List as a Template: Is my implementation correct?
body: <p>Please have a look at the following diagram</p>
  <p><img src="https://i.stack.imgur.com/0Gsto.png" alt="enter image description here" /></p>
  <p>This is how I implemented it</p>
  <pre><code>template &lt;typename T&gt;
  
  class LinkedList
  {
  
      struct Link {
      T data;
      struct Link *next;
  
      public:
      T *first;
    };
  
  
  
  LinkedList::LinkedList(void)
  {
      first = 0;
  }
  
  
  LinkedList::~LinkedList(void)
  {
  }
  
  bool LinkedList::IsEmpty()
  {
      return (first==0);
  }
  
  void LinkedList::Insert(Link *newLink)
  {
      newLink-&gt;next = first;
      first = newLink;
  }
  
  void LinkedList::Display()
  {
      Link *current = first;
  
      while(current!=0)
      {
          current-&gt;Display();
          current = current-&gt;next;
      }
  }
  
  T *LinkedList::Find(int value)
  {
      Link *current = first;
  
      while(current-&gt;GetData()!=value)
      {
          if(current-&gt;next==0)
          {
              return 0;
          }
          else
          {
              current = current-&gt;next;
          }
      }
  
      return current;
  }
  
  T *LinkedList::Delete(const int id)
  {
      Link *current = first;
      Link *previous = first;
  
      while(current-&gt;GetData()!=id)
      {
          if(current-&gt;next==0)
          {
              return 0;
          }
          else
          {
              previous = current;
              current = current-&gt;next;
          }
      }
  
      if(current==first)
      {
          first = first-&gt;next;
      }
      else
      {
          previous-&gt;next = current-&gt;next;
      }
  
      return current;
  }
  };
  </code></pre>
  <p>I do not feel comfortable about my implementation. Specially, I have no idea about what to do inside the <code>insert()</code> method, using <code>T</code> type.</p>
  <p>Following is the diagram for another class, it's <code>next</code> pointer is Weapons represent links within a linked list. I doubted whether this is the &quot;Link&quot; class as well. Next is a pointer to the next weapon in the list. I posted it here if it affects the above code.</p>
  <p><img src="https://i.stack.imgur.com/JZG6U.png" alt="enter image description here" /></p>
  <p>How to deal inside the <code>insert()</code> method? Apart from that, is my Linked List correct? First time with templates for Linked Lists anyway. Please help!</p>
  <p><strong>NOTE: BUILT IN DATA STRUCTURES ARE NOT ALLOWED. THAT IS WHY I POSTED THE DIAGRAM OF CLASSES. IF I NEED BUILT IN DATASTRUCTURE SUPPORT, THEN I AM NOT ASKING HOW TO BUILD THE CODE BY MY SELF.</strong></p>