📄 c08p418b.txt
字号:
// *********************************************************// Header file ListT.h for the ADT list.// Pointer-based implementation -- TEMPLATE VERSION// *********************************************************#include "ListNodeT.h"#include "ListException.h"#include "ListIndexOutOfRangeException.h"template <class T> class List{public:// constructors and destructor: List(); List(const List<T> & aList); virtual ~List(); // List operations: virtual bool isEmpty() const; virtual int getLength() const; virtual void insert(int index, T newItem) throw(ListIndexOutOfRangeException, ListException); virtual void remove(int index) throw(ListIndexOutOfRangeException); virtual void retrieve(int index, T & dataItem) const throw(ListIndexOutOfRangeException);protected: void setSize(int newSize); ListNode<T> *getHead() const; void setHead(ListNode<T> *newHead); T getNodeItem(ListNode<T> *ptr) const; ListNode<T> *getNextNode(ListNode<T> *ptr) const;private: int size; ListNode<T> *head; ListNode<T> *find(int position) const;}; // end class#include "ListT.cpp"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -