/** * Created by ahmad on 11/26/16. */ #include "LLStack.h" template LLStack::LLStack() { this->size = 0; this->head = nullptr; } template void LLStack::push(type data) { size++; LLStackNode *newNode = new LLStackNode; newNode->data = data; newNode->last = this->head; this->head = newNode; } template type *LLStack::pop(type &data) { size--; data = head->data; LLStackNode *lastTemp = head->last; delete head; head = lastTemp; return &data; } template type LLStack::last() { return (head->data)? head->data: nullptr; } template bool LLStack::isEmpty() { return this->size == 0; } template long LLStack::getSize() { return this->size; }