First page Back Continue Last page Overview Graphics
Implementation:
Associating Iterator & Aggregate
- How to associate the Iterator with the Aggregate?
- Aggregate creates Iterator of the right type and passes itself as a parameter to the constructor.
- Con: Aggregate must know all Iterator types.
- Client creates both and passes one to the other.
- Con: Client must know appropriate pairs.