Question: Continue to implement class my str below. This class defines a sequence of characters similar to the string type. Use a dynamically allocated c-string array

Continue to implement class my str below. This class defines a sequence of characters similar to the string type. Use a dynamically allocated c-string array of characters so it can be resized as needed. Write the time O(N) of each function in a comment above it. (N is the number of characters in the string argument. Do not add methods to the class my str, however feel free to add helper functions.

Continue to implement class my str below. This class defines a sequence

of characters similar to the string type. Use a dynamically allocated c-string

array of characters so it can be resized as needed. Write the

time O(N) of each function in a comment above it. (N is

the number of characters in the string argument. Do not add methods

to the class my str, however feel free to add helper functions.

class my.str public one parameter constructor constructs this object from a //

class my.str public one parameter constructor constructs this object from a // c-string s (s is an array of char terminated by 0' ) parameter, s, defaults to the empty string ' write and use strdup () to implement this constructor //it allocates a new array, then uses strcpy) to copy chars from array s to the new array my-str(const char *s="" ) { // you fill in //copy constructor for a my.str, must make a deep copy of s for this. (you can use strdup) you wrote) my.str( const my.str & s) // you fill in /assigns this my.str from my.str s (perform deep assignment,) /remember, both this and s have been previously constructed /so they each have storage pointed to by buf my-str &operator=( const my-str & s ) { // you fill in

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!