This section presents a pointer-based implementation of sorted lists that is derived from the ListAsLinkedList class given in Section . The SortedListAsLinkedList class is declared in Program . The class definition makes use of multiple inheritance: The SortedListAsLinkedList class is derived from both the SortedList class and the ListAsLinkedList class. The former provides the sorted list interface; the latter provides almost all of the implementation.
Program: SortedListAsLinkedList Class Definition
There are no additional member variables or member functions defined in the SortedListAsLinkedList class. The inherited member variables are sufficient to implement a sorted list. In fact, the functionality inherited from the ListAsLinkedList class is almost sufficient--the only member function of which the functionality must change is the Insert operation.