Problem 1 Modify the String class in the following ways:
a) Our String class always deletes the old character buffer and allocates a new character buffer on assignment or in the copy constructor. This need not be done if the new value is shorter than the current value and hence would fit the existing buffer. Rewrite the String class to only allocate a new buffer when necessary. Abstract the common tasks from the assignment operator and the copy constructor and place them in an internal (private) method.
b) Overload the compound += operator to perform concatenation of two String objects.
c) Overload the + operator using the += operator.
d) Add a member function compare (String) that returns -1 or 0 or 1 dep
Get Free Quote!
290 Experts Online