title: New to C++, can't figure why my program doesn't recognize these functions
body: <p>It keeps on saying &quot;function contains is never used&quot;. I've never posted before, so if you have advice on how I can get my point across better please let me know.</p>
  <p>[Edit] I'm trying to post only code that I wrote myself. I wrote these 3 functions, and only the first one works:</p>
  <p>This is what's in the CPP file:</p>
  <pre><code>template&lt;class ItemType&gt;
  ItemType LinkedList&lt;ItemType&gt;::replace(int position, const ItemType&amp; newEntry)
  {
      std::cout &lt;&lt; &quot;replacing at position &quot; &lt;&lt; position &lt;&lt; &quot; with &quot; &lt;&lt; newEntry &lt;&lt; std::endl;
      Node&lt;ItemType&gt;* curPtr =this-&gt;getNodeAt(position);
      curPtr-&gt;setItem(newEntry);
      return newEntry;
  }  // end replace
  
  
  // TODO: LinkedList&lt;ItemType&gt;&gt;::contains
  template&lt;class ItemType&gt;
  bool LinkedList&lt;ItemType&gt;::contains(const ItemType&amp; entry)
  {
      for(int i = 0; i&lt;this-&gt;getLength(); i++)
      {
          Node&lt;ItemType&gt;* curPtr = this-&gt;getNodeAt(i+1);
          if(curPtr-&gt;getItem()==entry) {
              return true;
          }
      }
      return false;
  }
  
  // TODO: LinkedList&lt;ItemType&gt;&gt;::containsRecursive
  template&lt;class ItemType&gt;
  bool LinkedList&lt;ItemType&gt;::containsRecursive(Node&lt;ItemType&gt;* node,const ItemType&amp; entry){
      if(node == nullptr){
          return false;
      }
      if(node-&gt;getItem()==entry){
          return true;
      }
      return containsRecusive(node-&gt;getNext(),entry);
  }
  </code></pre>
  <p>and this is what's in the header</p>
  <pre><code>ItemType replace(int position, const ItemType&amp; newEntry);
  bool contains(const ItemType&amp; entry);
  bool containsRecursive(Node&lt;ItemType&gt;* node,const ItemType&amp; entry);
  </code></pre>
  <p>and when I try to call it in the driver, it doesn't appear on the dropdown. Just the other functions in the program such as:</p>
  <p>replace, remove, insert, getNodeAt, getEntry, getLength, clear, and isEmpty</p>
  <p>and it basically says the function doesn't exist, when I call it in the driver
  with</p>
  <pre><code>listPtr-&gt;contains(&quot;hello&quot;); //doesn't work, turns red
  listPtr-&gt;replace(1,&quot;hello&quot;); //does work
  listPtr-&gt;containsRecurssive(headPtr, &quot;hello&quot;)//doesn't work, turns red
  </code></pre>
  <p>The contains is red, and it says,
  &quot;No member named 'contains' in 'ListInterfacestd::basic_string&lt;char&gt;'&quot;</p>
  <p>And it still says in the .h and the .cpp file that
  &quot;Function 'contains' is never used&quot;</p>
  <p>But all the other functions work fine.</p>