Advertisement
Phr0zen_Penguin

LinkedStack.h - VTC C++ Linked Stack Header

Apr 29th, 2015
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.20 KB | None | 0 0
  1. /**
  2.  * [LinkedStack.h]
  3.  * The LinkedStack class declaration/specification.
  4.  */
  5.  
  6. #ifndef LINKEDSTACK_H
  7. #define LINKEDSTACK_H
  8.  
  9. #include <iostream>
  10.  
  11. struct Node
  12. {
  13.     float   element;
  14.     Node    *next;
  15. };
  16.  
  17. class LinkedStack
  18. {
  19.     /**
  20.      * Everything under public can be accessed by all other programs or classes.
  21.      */
  22.     public:
  23.         /**
  24.          * Constructor(s):
  25.          */
  26.         LinkedStack();
  27.  
  28.         /**
  29.          * Constructor(s):
  30.          */
  31.         ~LinkedStack();
  32.  
  33.         /**
  34.          * Mutators:
  35.          */
  36.         void Push(float);
  37.  
  38.         /**
  39.          * Accessors:
  40.          */
  41.         void Pop(float &);
  42.  
  43.         /**
  44.          * General Use:
  45.          */
  46.         void MakeEmpty(void);       // empties the stack
  47.         bool IsEmpty(void);         // returns true if the stack is empty
  48.         bool IsFull();              // returns true if the stack is full
  49.  
  50.  
  51.     /**
  52.      * Everything under protected can be accessed only by the class itself or (derived) subclasses,
  53.      * as in the case of inheritance.
  54.      */
  55.     protected:
  56.  
  57.  
  58.     /**
  59.      * (Private) DATA MEMBERS/PROPERTIES:
  60.      *
  61.      * Everything under private can only be accessed by the class itself (the code in the
  62.      * implementation file).
  63.      */
  64.     private:
  65.         Node    *top;               // a node pointing to the top of the stack
  66. };
  67.  
  68. #endif // LINKEDSTACK_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement