EECS 370

Sample Exam Question

Arrays in C/C++ of N elements have subscripts from 0 as the lower bound to N-1 as the upper bound. Other languages (like Pascal) allow the user to specify any lower bound and upper bound subscript values to create an array of (upper bound - lower bound + 1) elements.

Create a class "Array" in C++ that allows a user to specify both forms of arrays. Each element in the array will be a floating point value. The class is to maximize the amount of information hiding. Your answer must clearly show the information that will go into the header file "array.h" and into the source code file "array.cpp". The header file must guarantee that multiple copies of the header information must not exist in any source code file.