Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MyString class In this assignment, you are to create MyString class that supports custom operators, such as addition, equality, and stream in and extraction. Following

image text in transcribed
MyString class In this assignment, you are to create MyString class that supports custom operators, such as addition, equality, and stream in and extraction. Following describes the member functions and operators of the Mystring class: I default constructor // constructor: creating a string from a char // constructor: creating a string from C.string // copy constructor /I destructor .MyString); MyString(const char sre); MyString(const chan* src) ystrings src), . MyString); // getter // getter // setter // copy assignment operator /I copy assignment operator /I copy assignment operator // addition operator / addition operator int Getlength() const char GetCharAt (int index) const; void SetCharAt (int index, char ch) const Mystrings operator (const char rhs); MyStrings operator- (const char rhs); . .MyString& operator (const MyString& rhs); MyString operator+ (const char* rhs) const; . Mystring operator+ (const MyString& rhs) const; / addition operator MyString operator+ (const char rhs) const; // addition assignment operator I addition assignment operator // addition assignment operator /I equal-to operator II equal-to operator // not-equal-to operator // not-equal-to operator MyString& operator+ (const char rhs); .MyString& operator+.(const char* rhs); MyString& operator+-(const MyString& rhs): bool operator.(const HyString& rhs) const; .bool operator-(const char* rhs) const; . bool operatorl-(const MyString& rhs) const; bool operator!-(const char* rhs) const; friend ostream operator> (istream& is, MyString& str) / stream extraction operaton You are provided with three startup files: /hone/cmpsc122/s19/hw3/mystring.h /home/cmpsc122/s19/hw3/mystring.cxx /home/cmpsc122/s19/hw3/testmystring.cxx mystring.h has the class declaration, nystring.cxx has the implementation of member functions and operators, and testmystring.cxx has the main program that tests your MyString class. In this assignment, you have to complete the implementation of the member functions and operators in mystring.exx. Do not change any code in mystring.h and testmystring.cxx. To compile and run the program, use the following commands: s 8++ -ansi -pedantic -Wall mystring.cxx testmystring.cxx -o testmystring s./testmystring If you pass all tests in testmystring.exx, the following messages will be printed at the end of its output Congratulation! Your program passed all 30 test cases Otherwise, the program will output the number of test cases your program failed

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

Advances In Databases And Information Systems 25th European Conference Adbis 2021 Tartu Estonia August 24 26 2021 Proceedings Lncs 12843

Authors: Ladjel Bellatreche ,Marlon Dumas ,Panagiotis Karras ,Raimundas Matulevicius

1st Edition

3030824713, 978-3030824716

More Books

Students also viewed these Databases questions