I have programmed a stack without libraries, however I am finding it difficult to find the error i have made and also if there is anything else that i need to include for my stack to work?
#include <iostream>
using namespace std;
template <typename T>
class Stack
{
public:
~Stack(void);
void push(T value);
Node<T>* nodePop(void);
T pop(void);
protected:
int count = 0;
Node<T> *pTop = nullptr;
};
class Node
{
public:
T value;
Node *pNext = nullptr;
};
template <typename T>
class Stack
{
public:
~stack(void);
void Push(T value);
Node<T>* NodePop(void);
T Pop(void);
Line 17: Node needs to be a template because it uses T. It also needs to precede stack.
Lines 25-36: Stack is declared twice.
Line 31: NodePop () is not implemented.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.