Copyright by Michael Fischer 11/13/2011 For use in Yale course CPSC 427a/527a, Fall term 2011. ------------------------------------------------------ This is an attempt to make example 20a-Multiple into a fully generic template class. Classes Cell, Container, Linear, List, and PQueue have all been modified to take a template parameter T, which is the element type for the container. Class Ordered has been modified to take a template parameter KeyType, which is the type of the key to be used for sorting. Type T must satisfy the promises in Ordered. To make sure this is true, we derive T from Ordered. We must also arrange for KeyType to be defined (using typedef) appropriately. In this example, T is instantiated by Item in main(). Item is derived from Exam and from Ordered. Exam defines KeyType to be int since we want to sort exams by score, and score is an int. Exam also contains the user content of the item, which consists of the student's initials and the score. Ideally, a container template should work with any element type T that satisfies minimal conditions. Here, we used a "helper" class Exam in defining class Item in order to get KeyType defined before it was used as a template parameter to Ordered. Other strategies might enable one to streamline this process.