Question: Just answer the two questions: 1. What are the class invariants for your implementation of the String class? Be clear about what the invariants are,

Just answer the two questions: 1. What are the class invariants for your implementation of the String class? Be clear about what the invariants are, but there's no deep explanation about "why" required here. 2. What are the preconditions for the String::substring member function? Be clear about what the preconditions are, but there's no deep explanation about "why" required here.

class String { public: //Initializes a string to be empty (i.e., its length will be zero and toChars() will return ""). String(); //substring() returns a substring of this substring, containing the characters beginning at startIndex and ending at (but not including) endIndex. For example, in the string "Boo is happy today", substring(7, 12) would return "happy". String substring(unsigned int startIndex, unsigned int endIndex) const; }

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!