2.2.1 Element type

An array is a container. Unlike an unrestricted container, all elements in an array must be of the same type. This implies that all elements must be of the same size, as well.

In C, it is impossible to define an array ADT that works for all possible types (built-in or user defined). This requires a C++ feature called ``template classes''. For the rest of this module, we assume that we the element type is fixed for an array ADT.



Copyright © 2006-09-13 by Tak Auyeung