Question: Define a class named CheckedArray. The objects of this class are like regular arrays but have range checking. If a is an object of the

Define a class named CheckedArray. The objects of this class are like regular arrays but have range checking. If a is an object of the class CheckedArray and i is an illegal index, then use of a[i] will cause your program to throw an exception (an object) of the class AnrayoutOfRangeError. Defining the class AnrayoutOfRangeError s part of this project. Note that, among other things your CheckedArray class must have a suitable overloading of the []operators, as discussed in Appendix 6. You can overload the square brackets, [], for a class so that they can be used with objects of the class. If you want to use []in an expression on the left-hand side of an assignment operator, then the operator must be defined to return a reference which is indicated by discussed for overloading the l/O operators >.) When overloading [], the operator [] must be a hen member function, the overloaded [] cannot be a friend operator (in this regard, [] is overloaded in away similar to the way in which the assignment operator is overloaded. overloading = is discussed in the section of Chapter 11 entitled "Overloading the Assignment operator*)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
