previous | start | next

## Operator Overloading

- Actual implementation of the operators is somewhat anticlimactic.

  >     string Iterator::operator*() const
  >     {
  >        assert(position != NULL);
  >        return position->data;
  >     }

  >     bool Iterator::operator==(Iterator b) const
  >     {
  >        return position == b.position;
  >     }

- Note the parameter in the postfix version of the `++` operator.

  >     void Iterator::operator++(int dummy) const
  >     {
  >        assert(position != NULL);
  >        return = position->next;
  >     }

- Also note that the `!=` operator uses the `==` operator.

  >     bool Iterator::operator!=(Iterator b) const
  >     {
  >        return !(*this == b); // calls operator ==
  >     }

previous | start | next