CS202 6- ‹#›
+= Operators
nlist & list::operator += (const list & l2) {
n  //why wouldn’t we program this way?
n  *this = *this + l2;
n  return *this;
n}
n
nOr, would it be better to do the following?
n
nlist & list::operator += (const list & l2) {
n if (!head) *this = l2;  //think about this...
n else {
n   node * dest = tail;
n   node * source = l2.head;
n   while (source) {
n     dest->next = new node;
n     dest = dest->next;
n     dest->obj = source->obj;
n     source = source->next;
n   }
n   dest->next = NULL; tail = dest; //ptr = temp.head; yes?
n  } return *this;
n}
n
n
n