Cover Data Structures and Algorithms with Object-Oriented Design Patterns in Java
next up previous contents index

Accessor Methods

Program gif defines three Array class accessor methods. The methods getData, getBase, and getLength provide a means for the user to inspect the contents of the Array object. Such methods are known as accessors . Clearly, the running times of each of these accessors is a constant.

   program2733
Program: Array class accessor methods.


next up previous contents index

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