CS202 6- ‹#›
Copy Constructor
n//List Class Implementation file:   list.c
n
nclass node {      //node definition
n  string obj;
n  node * next;
n};
n
nlist::list (const list & l) {
n  if (!l.head)
n    head = ptr = tail = NULL;
n  else {
n    head = new node;
n    head->obj = l.head->obj;
n
n    node * dest = head;    //why are these local?
n    node * source = l.head;
n    while (source) {
n      dest->next = new node;
n      dest = dest->next;
n      dest->obj = source->obj;  //what is this doing?
n    }
n    dest->next = NULL;
n    tail = dest;  ptr = head;
n  }
n}
n   
n