Question: create a visual basic program Lab 12 Create a template class called MyArray that implements an array and works with any type (int, double, etc.).

 create a visual basic program Lab 12 Create a template class

called MyArray that implements an array and works with any type (int,

create a visual basic program

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 array and use new to allocate memory (don't forget to delete in the destructor). Overload operatorl to access the elements of the array. If an attempt is made to access an element outside the array bounds (either above OR below), throw an exception In the main program, first create a MyArray int> object, add a few values, and demonstrate that operatorl 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<:string>. Be sure to test both GOOD and BAD index values. Include this header file #include object, add a few values, and demonstrate that operatorl 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<: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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!