The Iterator pattern allows you to access another object. The actual object would define an iterator object that is aware of the internals of the actual object, and uses this to access and traverse this object.
• Iterators are primarily used to encapsulate the actual object's internals, by providing another object as an accessor object. Again, the common theme here is that a change to the object's internals only implies a change to the iterator, and not to the end clients.
• Further, since the traversal is separate from the object itself, if the traversal itself changes, the object does not have to change. ATL, STL, and most of the .NET languages provide for an iterator to access a collection of objects.
Links: