Copyright by Michael Fischer 11/13/2011 For use in Yale course CPSC 427a/527a, Fall term 2011. ------------------------------------------------------ This is the example from section 16.4 of "Exploring C++" with some minor updates. It implements two linear containers of elements from an ordered set. List is an unordered list of elements; PQueue is an ordered list of elements. Both structures support deletion of arbitrary elements. Both are derived from an abstract class Linear. The element type Item is an adaptor class which forms the bridge between the generic container code and the specific element type Exam. Item is derived from Exam. Exam supplies a definition for typename KeyType and method key() that are used by Item. It also defines method operator<<() which is inherited by Item (and can be used to print items). Item supplies a constructor that calls the Exam constructor with Exam-specific arguments. For this code to work with an arbitrary element type T, T would have to define KeyType, key(), and print(). Item would have to derive from T instead of from Exam. An Item constructor appropriate to type T would have to be defined as well.