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

📄 listp.h

📁 Data Abstraction & Problem Solving with C++源码
💻 H
字号:
// *********************************************************// Header file ListP.h for the ADT list.// Pointer-based implementation.// *********************************************************#include "ListIndexOutOfRangeException.h"typedef desired-type-of-list-item ListItemType;class List{public:// constructors and destructor:   List();                    // default constructor   List(const List& aList);   // copy constructor   ~List();                   // destructor// list operations:   bool isEmpty() const;   int getLength() const;   void insert(int index, ListItemType newItem)         throw(ListIndexOutOfRangeException);   void remove(int index)         throw(ListIndexOutOfRangeException);   void retrieve(int index, ListItemType& dataItem) const         throw(ListIndexOutOfRangeException);private:   struct ListNode            // a node on the list   {      ListItemType     item;  // a data item on the list      ListNode        *next;  // pointer to next node   };  // end struct   int       size;  // number of items in list   ListNode *head;  // pointer to linked list of items   ListNode *find(int index) const;   // Returns a pointer to the index-th node   // in the linked list.}; // end class// End of header file.

⌨️ 快捷键说明

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