Question: Currently you have the Byte class derived from the CheckedArray class. What you may have noticed is that there is some redundant code that needs

Currently you have the Byte class derived from the CheckedArray class. What you may have noticed is that there is some redundant code that needs to be cleaned up. Here are the tasks to clean things up.
Remove the at function that is a member of the Byte class and create it as a virtual function in the base class. The at function should check to make sure the index provided is within the bounds of the array. If the index is out of bounds simply return 0.
Remove the [] operator from the Byte class and create it as a virtual function in the base class. This function should simply call the at function.
Create a virtual toString function in the CheckedArray class that will return a string representation of the array. You may want to investigate using the to_string function to convert each value in the array to a string.
In the derived class (Byte) override the toString function. The functionality for toString in both the base and derived classes is very similar with the exception that that Byte class should return the array in reverse. Have the Byte toString function called the CheckedArray toString function to get the string then return it in reverse order from Byte.
To reverse the string you can borrow some functionality from the algorithm and use the reverse function. You must include algorithm then you can reverse the string by providing iterators to the beginning and end. Here is a simple example:
string s ="123456";
reverse(s.begin(), s.end());
// String will be "654321:
Required
You must have your name, ID, Date, Assignment number, and a brief description of what the file is in comments at the top of each page. Failure to do this will result in 10 points being deducted off the top of your grade.

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 Programming Questions!