Question: Write your own simplified version of the std::string class, with the following specification. Please put the class definition on page 3 , and the implementation
Write your own simplified version of the std::string class, with the following specification. Please put the class definition on page 3 , and the implementation of the member functions on page 4 . You may use any of the standard C string library functions; you may assume that c cstring > is already included. You may not use the C++ library. Specification: - Class name is MyString. - Must include a default constructor, which initializes to an empty string. - Must include a destructor. - Must include a parameterized constructor, which takes a const char " and copies the string data into the object. - Member functions: empty - returns true if it's an empty string, false if non-empty size - returns the length of the string (does not include the null terminator) contains - takes either a character (char) or a string (const char *), returns true if the character or substring appears anywhere in the string, false otherwise
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
