Could someone check my code as to why my print function is not
working? Also my pop member function is getting an error in main.
template<class Type>
void Novice<Type>::Print()
{
while(! IsEmpty())
{
std::cout << topPtr->item;
topPtr = topPtr ->next;
}
}
template<class Type>
void Novice<Type>::Pop(Type &y)
{
if(IsEmpty())
throw EmptyStack();
else
{
Node<Type> *tempPtr;
tempPtr = topPtr;
topPtr = topPtr -> next;
delete tempPtr;
}
}
// main function
int main()
{
Novice<int> a;
a.Pop(); // not working
a.Push(1);
a.Push(2);
a.Push(3);
cout << a.length() << endl;
a.Pop();
cout << a.length() << endl;
a.Print();
}
The compilation error: 13 H:no matching function for call to
`Novice<int>::Pop()'