Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++. Please do not use this pointer we haven't learn this yet. Also, show your sample output as proof that the code works.Thanks 2.

In C++. Please do not use "this pointer" we haven't learn this yet.

Also, show your sample output as proof that the code works.Thanks

image text in transcribed

2. (50 marks) A string in C++ is simply an array of characters with the null character(10) used to mark the end of the string. C++provides a set of string handling function in as well as IO functions in . With the addition of the STL (Standard Template Library), C++ now provides a string class. But for this assignment, 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 th operator (and understand why!), work with C-Style strings and pointers, dynamically allocate memory and free it when done. e class body, develop a copy constructor and assignment Of course, you must also do suitable testing which implies writing a main function that uses your new string class. Submit your assignment under URCourses. The following is the skeleton of the Mystring class declaration. Mystring.h file is provided. You must produce the Mystring.cpp and main.cpp files. class Mystring private: char pData; pointer to simple C-style representation of the string //i.e., sequence of characters terminated by null) "pData is only a pointer. You must allocate space for /the actual character data /length of the string int length; /possibly other private data public: MyString0: onstructorcreate empty string MyString(char *cString); /constructorcreate a string whose data is a copy of /cString MyStringo: /destructor -- don't forget to free space allocated by the constructor i.e., the space allocated for the character data MyString(MyString const&s); override the default copy constructorwhy? importantthink about it possible test question MyString operator= (MyString const& s); //override default assignment operator void PutO void Reverse) reverse the string /output string MyString operator (MyString const& s): concatenation operator other useful member functions as you wish In addition, prepare a graphical explanation of each of your member functions. (Pseudo code or flowchart or some diagram to show your design.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions

Question

How do you see the company changing over the next 5 years?

Answered: 1 week ago

Question

Evaluate the influence and current status of humanistic psychology?

Answered: 1 week ago

Question

3. Describe the communicative power of group affiliations

Answered: 1 week ago