Im making a templated stack but Im getting some grief and not too sure what Ive done wrong. Its saying Ive got an unresolved external when trying to make a new stack. Any help would be much appreciated.
Stack.h
#pragma oncetemplate <class Type>class Stack{private: typedef struct node { Type item; node *next; } snode; snode *top, *z; public: Stack(); ~Stack(){}; Type Pop(void); void Push(Type argItem); bool IsEmpty(void); };
Stack.cpp
#include <iostream>using namespace std;#include "Stack.h"template <class Type>Stack<Type>::Stack(){ z = new snode; z->next = z; top = new snode; top->next = z; }template <class Type>void Stack<Type>::Push(Type argItem){ snode *temp; temp = top; top = new snode; top->next = temp; top->item = argItem;}template <class Type>bool Stack<Type>::IsEmpty(void){ if( top->next == z) return true; else return false; }template <class Type>Type Stack<Type>::Pop(void){ Type returnItem; if (isEmpty()) { cout<<"\n empty "; return null; } returnItem = top->item; snode *temp; temp = top; top = top->next; delete temp; return returnItem;};