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

Member Functions

Program gif also declares the constructor, the destructor, and the two member functions Key and Subtree. The constructor takes a single unsigned int argument, say M, and initializes the fields of the object as follows: The constant member variable m is set to M; the member variable numberOfKeys is set to zero; the key array is initialized to length M-1 and base 1; and, the subtree array is initialized to length M.

The member functions Key and Subtree are member variable accessors which are used to access the components of an MWayTree. The first, Key, takes an unsigned int argument between 1 and M-1 and returns a reference to the specified element of the key array. Similarly, the Subtree function takes an unsigned int argument between 0 and M-1 and returns a reference to the specified subtree.


next up previous contents index

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