c04p191.txt

来自「Data Abstraction & Problem Solving with 」· 文本 代码 · 共 26 行

TXT
26
字号
List::List(const List& aList): size(aList.size){   if (aList.head == NULL)      head = NULL;  // original list is empty   else   {  // copy first node      head = new ListNode;      head->item = aList.head->item;      // copy rest of list      ListNode *newPtr = head;  // new list pointer      // newPtr points to last node in new list      // origPtr points to nodes in original list      for (ListNode *origPtr = aList.head->next;                   origPtr != NULL;                   origPtr = origPtr->next)      {  newPtr->next = new ListNode;         newPtr = newPtr->next;         newPtr->item = origPtr->item;      }  // end for      newPtr->next = NULL;   }  // end if}  // end copy constructor

⌨️ 快捷键说明

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