singleLinkedList.h
注意事项:
1、注意常函数
2、传入指针的引用与否
a
传入前是否分配空间
b
只修改地址或内容或二者兼而有之
3、接口语义区分
virtual void insert(const T& theElement,int theIndex) = 0;//指序插入
//virtual void insert(const T& theElement,int theIndex) = 0;//前序插入
//virtual void insert(int theIndex,const T& theElement) = 0;//后序插入
收获:
1、(int initialCapacity/* =10 */)//声明缺省,实现不必repeat
2、指针通过等于号copy是浅复制,指向同一个对象,危险!!
3、add else Statement to improve the readability,维护性
4、using the Construtor to decrease the extra cost
//firstNode = new singleLinkedListNode(theElement, firstNode);
5、erase中不同Statement中合并了删除这个操作
疑问:
1、pointer to first node in singleLinkedList ????????why not headerNode???
2、 /*原先的first Node怎么办,没销毁????????????????????*/
3、 {/*?????? why nextNode不会重名(局部变量销毁),firstNode 作为 this->firstNode 一直存在(对象删除后乱码)?????? */
4、传入指针的引用与否
i.e changeLength1D,make2dArray
a
传入前是否分配空间
b
只修改地址或内容或二者兼而有之