Question: d. blackboard.com/webapps/blackboard/content/listContentjsp?course id bs Lab 12 Create a template class called MyArray that implements an array and works with any type (int, double, etc.). The
d. blackboard.com/webapps/blackboard/content/listContentjsp?course id bs Lab 12 Create a template class called MyArray that implements an array and works with any type (int, double, etc.). The constructor should take a size for the amay and use new to allocats memory (don't forget to delete in the destructor). Overload operatorll to access the elements of the array If an attempt is made to access an elerment outside the array bounds (either above OR below), throw an exception In the main program, first create a MyArray inb object, add a few values, and demonstrate that operatord throws an std out of range If an attempt is made to access an out-of-bounds element (out-of-bounds means above OR below the array bounds) Catch the exception and print an appropriate message Then do the same thing with an MyArray std::string>. Be sure to test both GOOD and BAD index values. Include this header file #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
