Question: Need help implementing these class members? This is the privided string class: https://docs.google.com/document/d/1SzlPX5AVKHnuLGmWO0TCQfr8gWE976yGwMLbZCpvDS8/edit?usp=sharing Now i must implement these functions. Details are described below. We also

Need help implementing these class members?

This is the privided string class: https://docs.google.com/document/d/1SzlPX5AVKHnuLGmWO0TCQfr8gWE976yGwMLbZCpvDS8/edit?usp=sharing

Now i must implement these functions. Details are described below. Need help implementing these class members? This is the privided string class:https://docs.google.com/document/d/1SzlPX5AVKHnuLGmWO0TCQfr8gWE976yGwMLbZCpvDS8/edit?usp=sharing Now i must implement these functions. Details are described below. Wealso ave to create a test driver main file to test out

We also ave to create a test driver main file to test out the functions we reated in out string class. Here is the link to a provided one. https://docs.google.com/document/d/1YqoY57bUIpplXELI0xtuNRp92AJB4ZGT014tnQysbaE/edit?usp=sharing

Let me know if you have any issues. Thank you for your time and have a great day!

The MyString Class will contain the following private data members m_buffer, a char-type pointer, pointing to the Dynamically Allocated data. Note: This is no longer a static array. Dynamic Memory management has to guarantee that it points to a properly allocated memory region, otherwise Segmentation Faults will occur in your program. Also, Dynamic Memory management has to guarantee that it is properly deallocated when appropriate, and deallocated-&-reallocated when its size has to change m_size, an int, denoting how many characters are currently allocated for m buffer. Note that this has to be properly initialized and updated each time the dynamically allocated memory is changed , will have the following private helper methods: (13) buffer_deallocate - will deallocate the dynamic memory pointed to by m_buffer Note: The m size which keeps track of m buffer has to be updated too >(14) buffer_allocate - will allocate the required int size number of char elements and point m_ buffer to it. It also has to check whether there is an already allocated space for m buffer, and properly deallocate it prior to reallocating the new memory required Note: The m_size which keeps track of m_buffer has to be updated too. Also you should at least be checking whether the new expression used to allocate data succeded or failed (you can check if it evaluated to a NULL value). (Hint: You may also want to try implementing the "correct" way via exception handling for the dynamic memory allocation) and will have the following public member functions (1) Default Constructor - will instantiate a new object with no valid data. Hint: which member(s) need to be initialized in this case? (2) Parametrized Constructor - will instantiate a new object which will be initialized to hold a copy of the C-string str passed as a parameter. Hint: has to properly handle allocation, and to do this it will need to "examine" the input C-string to know how many items long the allocated space for m buffer has to be (3) Copy Constructorwll instantiate a new object which will be a separate copy of the data of the other myStr object which is getting copied. Hint: Remember deep and shallow object copies (4) Destructor -will destroy the instance of the object. Hint: Any dynamically allocated memory pointed-to by m_buffer has to be deallocated in here (5) size will return the size of the currentl (6) length will return the size of the string without counting the null-terminating character y alloca ted char buffer (number of eleme nts) (same rationale as C-string length checking). Hint: The return value of this method and size0 will of course be different. (7cstr will return a pointer to a char array which will represent the C-string equivalent of the calling MyString object's data. Hint: It has to be a NULL-terminated char array in order to be a valid C-string representation. (8) operator-will check if (or if not) the calling object represents the same string as another MyString object, and return true (or false) respectively (9) operator= will assign a new value to the calling obje the other_myStr object pa tring data, based on the data of ed as a parameter. Returns a reference to the calling object to be

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!