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

Array Implementation

Program gif defines an array implementation of a deque. The DequeAsArray class is defined using multiple inheritance: It is derived from both the Deque abstract base class and the QueueAsArray array-based implementation of a queue. The Deque class provides the interface; the QueueAsArray, the implementation.

   program8448
Program: DequeAsArray Class Definition

The QueueAsArray implementation provides almost all of the required functionality. For example, Program gif shows that the Head, EnqueueTail and DequeueHead operations of the DequeAsArray class are implemented by calling the appropriate QueueAsArray class operations.

   program8464
Program: DequeAsArray Class Head EnqueueHead and DequeueHead Member Function Definitions




next up previous contents index

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