Question: A string in C++ is simply an array of characters with the null character() used to mark the end of the string Ch provides a

 A string in C++ is simply an array of characters with

A string in C++ is simply an array of characters with the null character() used to mark the end of the string Ch provides a set of string handling function in as well as to functions Vith the addition of the STL (Standard Template Library), C++ now provides a 1 of 4 gnment, you are to develop your own string class. This will give you a chance to develop and work with a C++ class, define constructors and destructors, define member functions outside of the class body, develop a copy constructor and assignment operator (and understand why!), work with C-Style strings and pointers, dynamically allocate memory and free it when done. Of course, you must also do suitable testing which implies writing a main function that uses your new string class. The following is the skeleton of the Mystring class declaration. Mystring h file is provided. You must produce the Mystring epp and main.cpp files. class Mystring 1 private: char "pData: pointer to simple C-style representation of the string Ii.e., sequence of characters terminated by mull) MpData is only a pointer. You must allocate space for the actual character data int length: Mlength of the string possibly other private data public: MyString: Il constructor --- Create empty string MyString(char *eString): /iconstructor --- Create a string whose data is a copy of cString - MyString: destructor - don't forget to free space allocated by the constructor Vic, the space allocated for the character data MyString(MyString const& s: /override the default copy constructor --- why? important - think about it -- possible test question MyString operator - (MyString const&s: Moverride default assignment operator void Put): Houtput string void Reversel)reverse the string MyString operator + (MyString const&s): concatenation operator other useful member functions as you wish In addition, prepare a graphical explanation of cach of your member functions (You can use Pseudo code or flowchart or some diagram to show your design.)

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!