ConcreteAggregate depends on the class
ConcreteIterator because the
CreateIterator() method creates an instance of the
ConcreteIterator class and returns it to the caller as an instance of the more general
ConcreteIterator class has a constructor that is not shown on this diagram. What must be the case is that the
CreateIterator() method is passing its own instance (i.e.,
this) as a parameter to that constructor. The
ConcreteIterator class stores the reference that was passed to it as a member variable, shown in this UML diagram as a unidirectional association.
You didn't ask, but I will tell you that there are many problems with the UML on this diagram. Therefore, do not use this book to learn UML!
- The triangles shown on the generalization relations should be drawn at the top of the line, not on the middle of the line.
- The association arrowheads are supposed to be open (like
- The associations do not show association-end properties, such as the one representing the member variable that the constructor for the
ConcreteIterator class sets. I would expect to see something like
creatingAggregate near the arrowhead.
- The associations do not show any multiplicity, which defaults to [1..1] in UML. That implies that an instance of the
Client class must have a reference to an instance of the
Iterator class at all times, which is obviously impossible. (An instance of
Client must first call that
CreateIterator() method to get that reference!) That multiplicity should have been optional [0..1].
CreateIterator() method shows no return type of
Correcting some of these mistakes may have made this book more understandable for you.