#ifndef STACK_H
#define STACK_H

template <class Type, int MaxSize> class Stack
{
protected:
  Type Element[MaxSize];
  int StackPointer;
public:
  Stack();
  virtual ~Stack();
  bool Empty() const;
  bool Full() const;
  Type Top() const;
  void Pop();
  void Push(const Type & NewElement);
};

template <class Type, int MaxSize>
  Stack<Type, MaxSize>::Stack() : StackPointer(-1)
  { }

template <class Type, int MaxSize>
  Stack<Type, MaxSize>::~Stack()
  { }

template <class Type, int MaxSize>
  bool Stack<Type, MaxSize>::Empty() const
  {
  return StackPointer == -1 ? true : false;
  }

template <class Type, int MaxSize>
  bool Stack<Type, MaxSize>::Full() const
  {
  return StackPointer == MaxSize - 1 ? true : false;
  }

template <class Type, int MaxSize>
  Type Stack<Type, MaxSize>::Top() const
  {
  return Element[StackPointer];
  }

template <class Type, int MaxSize>
  void Stack<Type, MaxSize>::Pop()
  {
  StackPointer--;
  }

template <class Type, int MaxSize>
  void Stack<Type, MaxSize>::Push(const Type & NewElement)
  {
  StackPointer++;
  Element[StackPointer] = NewElement;
  }

#endif
