⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c08p409b.txt

📁 Data Abstraction & Problem Solving with C++源码
💻 TXT
字号:
// *********************************************************// Header file List.h for the ADT list.// Uses ListNode and BasicADT.// *********************************************************#include "ListNode.h"   // as specified in previous section,                        // also specifies ListItemType#include "ListException.h" #include "ListIndexOutOfRangeException.h"#include "BasicADT.h"class List : public BasicADT{public:// constructors and destructor:   List();   List(const List& aList);   virtual ~List();// list operations:   virtual bool isEmpty() const;   virtual int getLength() const;   virtual void insert(int index, ListItemType newItem)          throw(ListIndexOutOfRangeException, ListException);   virtual void remove(int index)          throw(ListIndexOutOfRangeException);   virtual void retrieve(int index,                    ListItemType& dataItem) const          throw(ListIndexOutOfRangeException);protected:   void setSize(int newSize);       // sets size   ListNode *getHead() const;       // returns head pointer   void setHead(ListNode *newHead); // sets head pointer   // the next two functions return the list item or    // next pointer of a node in the linked list   ListItemType getNodeItem(ListNode *ptr) const;   ListNode *getNextNode(ListNode *ptr) const;private:   int      size;    // number of items in the list   ListNode *head;   // pointer to the linked list   ListNode *find(int index) const;};  // end class

⌨️ 快捷键说明

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