📄 listaexcept.h
字号:
// *********************************************************// Header file ListAexcept.h for the ADT list// Array-based implementation with exceptions// *********************************************************#include "ListException.h"#include "ListIndexOutOfRangeException.h"const int MAX_LIST = maximum-size-of-list;typedef desired-type-of-list-item ListItemType;class List{public: List(); // default constructor // destructor is supplied by compiler// list operations: bool isEmpty() const; // Exception: None. int getLength() const; // Exception: None. void insert(int index, ListItemType newItem) throw(ListIndexOutOfRangeException, ListException); // Exception: Throws ListIndexOutOfRangeException if // index < 1 or index > getLength()+1. // Exception: Throws ListException if newItem cannot be // placed in the list because the array is full. void remove(int index) throw(ListIndexOutOfRangeException); // Exception: Throws ListIndexOutOfRangeException if // index < 1 or index > getLength(). void retrieve(int index, ListItemType& dataItem) const throw(ListIndexOutOfRangeException); // Exception: ListIndexOutOfRangeException if // index < 1 or index > getLength().private: ListItemType items[MAX_LIST]; // array of list items int size; // number of items in list int translate(int index) const;}; // end List class// End of header file.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -