注意事項(xiàng):
1、注意常函數(shù)
2、傳入指針的引用與否
a
傳入前是否分配空間
b
只修改地址或內(nèi)容或二者兼而有之
3、接口語義區(qū)分
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 */)//聲明缺省,實(shí)現(xiàn)不必repeat
2、指針通過等于號copy是淺復(fù)制,指向同一個對象,危險(xiǎn)??!
3、add else Statement to improve the readability,維護(hù)性
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
只修改地址或內(nèi)容或二者兼而有之