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

Array Implementation

The SortedListAsArray class is declared in Program gif. Notice the use of multiple inheritance: The SortedListAsArray class is derived from both the SortedList class and the ListAsArray class. The SortedList base class is an abstract class. It provides the sorted list interface. The ListAsArray base class is a concrete class from which the sorted list class inherits much of its functionality.

   program10503
Program: SortedListAsArray Class Definition

There are no addition member variables required to implement the SortedListAsArray class. I.e., the member variables provided by the base class ListAsArray are sufficient. However, there is an additional private member function declared called FindOffset. As explained below, FindOffset is used by other member functions to locate an item in the sorted list.




next up previous contents index

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