Logo Data Structures and Algorithms with Object-Oriented Design Patterns in C++
next up previous contents index

Linked List Implementation

This section presents a pointer-based implementation of sorted lists that is derived from the ListAsLinkedList class given in Section gif. The SortedListAsLinkedList class is declared in Program gif. 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.

   program10834
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.




next up previous contents index

Bruno Copyright © 1997 by Bruno R. Preiss, P.Eng. All rights reserved.