Question: 5 : 2 3 In this assignment, you will continue to work on the myString class from Assignment 2 . You may start with the

5:23
In this assignment, you will continue to work on the myString class from Assignment 2. You may start with the posted solution for Assignment 2 if you wish.
Functionalities
In addition to the functionalities provided in Assignment 2, you should also provide the following methods. Here, "current string" refers to the string that the method is called with. I.e. in s.length(), s is the "current string."
char& operator [](int i): returns a reference to the i th character. Also provide a version which returns a reference to a constant. They should replace the corresponding at () from the previous assignment.
myString& operator+=(const myString& s): concatenates s to the current string. The current string is modified and a reference to it is returned.
myString operator+(const myString& s): returns a new string which is the current string concatenated with s. The current string is not modified.
bool operator==(const myString& s): returns true if the two strings are equal, false otherwise.
bool operator(const myString& s): returns true if the current string is lexicographically smaller than s, 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:
1
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
 5:23 In this assignment, you will continue to work on the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!