stackp.h

来自「Data Abstraction & Problem Solving with 」· C头文件 代码 · 共 33 行

H
33
字号
// *********************************************************// Header file StackP.h for the ADT stack.// Pointer-based implementation.// *********************************************************#include "StackException.h"typedef desired-type-of-stack-item StackItemType;class Stack{public:// constructors and destructor:   Stack();                     // default constructor   Stack(const Stack& aStack);  // copy constructor   ~Stack();                    // destructor// stack operations:   bool isEmpty() const;   void push(StackItemType newItem);   void pop() throw(StackException);   void pop(StackItemType& stackTop) throw(StackException);   void getTop(StackItemType& stackTop) const                                   throw(StackException);private:   struct StackNode              // a node on the stack   {      StackItemType item;        // a data item on the stack      StackNode    *next;       // pointer to next node   };  // end struct   StackNode *topPtr; // pointer to first node in the stack};  // end Stack class// End of header file.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?