Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
