| |
| | [No title] |
 | | An iterator object is responsible for keeping track of the current element; that is, it knows which elements have been traversed already. |
 | | Consider a typical iterator application: given binary tree, define one iterator to traverse it in inorder, another to traverse the same tree in preorder, yet another in reverse inorder, and so so on. |
 | | Iterator examples ================= Consider the situation where a client class needs a sequence of numbers, but wants to be independent whether that sequence is stored in an array, a linked list, a tree, or is computed on the fly by an algorithm, and so on. |
| csr.uvic.ca /~vanemden/oosd/2.patt/05.iteratorPatt.txt (1117 words) |
|