17.6.1 Example: Implementing Iterator Operators

Recall Iterator, defined on our List of strings. We can now overload the standard operators:

Iterator& Iterator::operator++(int)
{
   position = position->next;
   return *this;
}

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

prev |top |next