Discards qualifiers error
<p>For my compsci class, I am implementing a Stack template class, but have run into an odd error:</p>

<blockquote>
  <p>Stack.h: In member function ‘<code>const T Stack&lt;T&gt;::top() const</code> [with T = int]’:</p>
  
  <p>Stack.cpp:10: error: passing ‘<code>const Stack&lt;int&gt;</code>’ as ‘<code>this</code>’ argument of ‘<code>void Stack&lt;T&gt;::checkElements()</code> [with T = int]’ discards qualifiers</p>
</blockquote>

<p><code>Stack&lt;T&gt;::top()</code> looks like this:</p>

<pre><code>const T top() const {
    checkElements();
    return (const T)(first_-&gt;data);
}
</code></pre>

<p><code>Stack&lt;T&gt;::checkElements()</code> looks like this:</p>

<pre><code>void checkElements() {
    if (first_==NULL || size_==0)
        throw range_error("There are no elements in the stack.");
}
</code></pre>

<p>The stack uses linked nodes for storage, so <code>first_</code> is a pointer to the first node.</p>

<p>Why am I getting this error?</p>
