// P.J. Waskiewicz  4/15/1998
// File: Tstack.h
// Header file for stack ADT using a linked list

#ifndef _TSTACK_H_
#define _TSTACK_H_

template <class T>
class Stack {
public:
  Stack();
  // Precondition: None
  // Postcondition: An empty stack is created
  void push(T e);
  // Precondition: None
  // Postcondition: Element e is now at the top of the stack
  T pop();
  // Precondition: There is at least one element in the stack
  // Postcondition: The element at the top of the stack is returned
  //    and it is removed from the stack
  T top();
  // Precondition: There is at least one element in the stack
  // Postcondition: The element at the top of the stack is returned
  bool isEmpty();
  // Precondition: None
  // Postcondition: Returns true if stack is empty, false if not empty

private:
  struct Node;
  typedef Node * Link;
  struct Node {
    T data;
    Link next;
  };
  Link head;
};

#include "Tstack.cc"

#endif