Question: C++ 1. String Bound Exceptions Write a class BCheckString that is derived from the STL string class. This new class will have two member functions:
C++


1. String Bound Exceptions Write a class BCheckString that is derived from the STL string class. This new class will have two member functions: A) A BCheckString(string s) constructor that receives a string object passed by value and passes it on to the base class constructor. B) An char operator[](int k) function that throws a Bounds Exception object if k is negative or is greater than or equal to the length of the string. If k is within the bounds of the string, this function will return the character at position k in the string. You will need to write the definition of the BoundsException class. Test your class with a main function that attempts to access characters that are within and outside the bounds of a suitably initialized BCheckString object. For #1, The class you will be creating has an attribute as a string object. There is a built-in function , length(), that returns the number of characters of the string object. For you who
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
