How to declare destructor of a templated class
<p>I get error while trying to compile following class</p>

<p>Stack.cpp:28: error: expected constructor, destructor, or type conversion before ‘::’ token</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

template &lt;class T&gt;
class Stack
{
public:
    Stack(): head(NULL) {};
    ~Stack();

    void push(T *);
    T* pop();

protected:
    class Element {
    public:
            Element(Element * next_, T * data_):next(next_), data(data_) {}
            Element * getNext() const { return next; }
            T * value() const {return data;}
    private:
            Element * next;
            T * data;
    };

    Element * head;
};

Stack::~Stack()
{
    while(head)
    {
            Element * next = head-&gt;getNext();
            delete head;
            head = next;
      }
 }
</code></pre>
