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 insertion 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 insertion and extraction. Following describes the member functions and operators of the MyString class: .MyString); . MyString(const char src); Mystring(const char* src): .MyString(const MyString& src): .MyString): .int GetLength) const; . char GetCharAt (int index) const; // default constructor /I constructor: creating a string from a char // constructor: creating a string from C-string /I copy constructor /I destructor // getter // getter // setter /I copy assignment operator I copy assignment operator II copy assignment operator // addition operator // addition operator /1 addition operator II addition assignment operator // addition assignment operator void SetCharAt (int index, char ch) const .MyString& operator. (const char rhs); .MyString& operator (const char* rhs); * Mystrings operator. (const MyString& rhs); MyString operator+ (const char rhs) const; MyString operator+ (const char* rhs) const; .MyString operator+ (const Mystring& rhs) const; MyString operator+ (const char rhs); MyStrings operator+s(const char* rhs); MyString& operator (const MyStrings rhs): . bool operator (const MyString& rhs) const; .bool operator! (const MyString& rhs) const; . friend ostreams operatorss (ostrean& os, const MyString& str);// strean insertion operator addition assignment operator // equal-to operator // equal-to operator /I not-equal-to operator /1 not-equal-to operator bool operator (const char* rhs) const; bool operator!-(const char* rhs) const . friend istream& operator> (istream& is, MyString& str);I // strean extraction operator You are provided with three startup files: home/cmpsc122/s19/hw3/mystring.h /home/cmpsc122/s19/hw3ystring.cxx /home/cmpsc122/s19/hw3/testmystring.cxx nystring.h has the class declaration, mystring.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.cxx. Do not change any code in mystring.h and testmystring.cxx. To compile and run the program, use the following commands sansi -pedantic -wall mystring.cxx testmystring.cxx- testmystring s ./testmystring If you pass all tests in testmystring.cxx, the following messages will be printed at the end of its output Congratulation! Your program passed al1 38 test cases. Otherwise, the program will output the number of test cases your program

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2017 Skopje Macedonia September 18 22 2017 Proceedings Part 3 Lnai 10536

Authors: Yasemin Altun ,Kamalika Das ,Taneli Mielikainen ,Donato Malerba ,Jerzy Stefanowski ,Jesse Read ,Marinka Zitnik ,Michelangelo Ceci ,Saso Dzeroski

1st Edition

3319712721, 978-3319712727

More Books

Students also viewed these Databases questions