The essential characteristic of a queue is that elements can only be add ed at the end of the queue and can only be retrieve d from the front. The actions are shown in the class diagram in Figure 14.4. These actions are implemented by making the appropriate actions from the UnorderedList public, as follows.
End add .
End retrieve . End Queue . A demonstration test harness for the Queue class, using a queue of Persons as introduced in the last chapter, might be as follows. End QueueDemo . The Queue constructor, called on line 0021, needs to have an instance of the Class class passed to it in order that it can know which elements may be stored in the queue.