Saturday, July 29, 2017

stack.cpp

#include"stack.h"

Stack::Stack()
{
  LinkedList* list = new LinkedList();
}

Stack::~Stack()
{
  removeAll();
}

int Stack::empty()
{
  return list->empty();
}

void Stack::push(int num)
{
  list->prepend(num);
}

int Stack::pop()
{
  return list->removeHead();
}

No comments:

Post a Comment