Answered step by step
Verified Expert Solution
Question
1 Approved Answer
5 : 2 3 In this assignment, you will continue to work on the myString class from Assignment 2 . You may start with the
:
In this assignment, you will continue to work on the myString class from Assignment You may start with the posted solution for Assignment if you wish.
Functionalities
In addition to the functionalities provided in Assignment you should also provide the following methods. Here, "current string" refers to the string that the method is called with. I.e in slength s is the "current string."
char& operator int i: returns a reference to the th character. Also provide a version which returns a reference to a constant. They should replace the corresponding at from the previous assignment.
myString& operatorconst myString& : concatenates to the current string. The current string is modified and a reference to it is returned.
myString operatorconst myString& s: returns a new string which is the current string concatenated with The current string is not modified.
bool operatorconst myString& : returns true if the two strings are equal, false otherwise.
bool operatorconst myString& : returns true if the current string is lexicographically smaller than and false otherwise. "Lexicographically smaller" means that "appears earlier in a dictionary." For example, "abc" is lexicographically smaller than "adc," and he is lexicographically smaller than "hello."
The remaining comparisons: Hint: use the two operators above.
Also, provide the following friend functions:
operator operator: reads and writes into strings. For reading, note that you should ignore all whitespaces, and then read until the first whitespace. Use isspace in
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started