nNotice why a “first” and
“second” shouldn’t be data members:
n
nbool list::operator ==
(const list & l2) const {
n node * first = head;
n node * second = l2.head;
n while (first && second &&
first->obj == second->obj) {
n first = first->next;
n second = second->next;
n }
n if (first || second) return FALSE;
n return TRUE;
n}
n
n
nEvaluate the efficiency of
the following:
n
nbool list::operator !=
(const list & l2) const {
n return !(*this == l2);
n }
n