Programming Exercise processes only int arrays. Redesign the class safeArray using class templates so that the class can be used in any application that requires arrays to process data.
Programming Exercise
(Safe Arrays) In C++, there is no check to determine whether the array index is out of bounds. During program execution, an out-of-bound array index can cause serious problems. Also, recall that in C++ the array index starts at 0.
Design a class safeArray that solves the out-of-bound array index problem and allows the user to begin the array index starting at any integer, positive or negative. Every object of type safeArray should be an array of type int . During execution, when accessing an array component, if the index is out of bounds, the program must terminate with an appropriate error message. For example,
safeArray list (2, 13);safeArray yourList(−5, 9);
In this example, list is an array of 11 components, … the component type is int , and the components are list[2] , list[3], …, list[12] . Also, yourList is an array of 15 components, the component type is int, and the components are yourList [−5], yourlist[−4], …, yourList[0], …, yourList[8].
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.