Skip to content

Instantly share code, notes, and snippets.

@tyleryasaka
Created October 7, 2014 20:38
Show Gist options
  • Save tyleryasaka/fa6d8325df901787bec6 to your computer and use it in GitHub Desktop.
Save tyleryasaka/fa6d8325df901787bec6 to your computer and use it in GitHub Desktop.
stack.h
#ifndef _STACK_H
#define _STACK_H
#include <iostream>
using namespace std;
template <class T>
class Stack{
T* data;
int top;
int max_size;
public:
Stack();
Stack(int size);
Stack(const Stack<T>& s);
Stack& operator=(const Stack<T>& s);
~Stack();
bool IsEmpty()const;
bool IsFull()const;
bool Push(T item);
bool Pop(T &item);
template <class U>
friend ostream& operator<<(ostream& os, const Stack<U>& s);
};
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment