Design patterns implementation examples

Iterator

Definition:

Gives normalised access to different object collections.


Example:

For instance I have a collection of jpg files in one directory and a collection of gif files in another one. A program which I use gives me a possibility to view pictures. All I need to do is to select directory.


C++ code:

/src/iterator.cpp
Download source code

Iterator UML class diagram:
Iterator UML class diagram

Iterator UML sequence diagram:
Iterator UML sequence diagram