Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 91 IntList& IntList::operator=(const IntList& source){
- 92 //deep copy version
- 93 Node* n = new Node;
- 94 Node* p = source.first;
- 95 IntList* list = new IntList;
- 96 list->first = n;
- 97 while(p) {
- 98 if (!n) {
- 99 Node* s = new Node;
- 100 s->info = p->info;
- 101 n = s;
- 102 } else {
- 103 n->info = p->info;
- 104 }
- 105 n = n->next;
- 106 p = p->next;
- 107 }
- 108 return *list;
- 109 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement