/* OurStrings.h */ /* Some questions to ask Label the private data members. Label the public data members. Label the private function/methods. Label the public function/methods. Label the constructor(s). Label the destructors(s). Are the operator + functions members of the class? Is c_str a member of the class? What would the .cpp file corresponding to this .h file look like? Give a reasonable implemenation of the length function. Label any accessors. Label any mutators. Label any friend functions. What can friend functions do that other functions outside the classs cannot? Label any instances of functions overloading. Label any instances of operator overriding. What are the big three? Are any of them present here? are they all present here? Explain why if you have one you should have them all. Where are the file guards and what is their purpose? What is the name of the class? How could you declare a variable of this type? How could you call the various public member functions? */ #ifndef _OURSTRING_H #define _OURSTRING_H #include #include #include #include using namespace std; class OurString { private: unsigned len; unsigned arraySize; char * cstring; void expandArraySize(); public: OurString(); OurString(char * s); OurString(const OurString &s); ~OurString(); void operator = (const OurString &rightSide); void operator = (char * s); friend OurString operator + (const OurString &s1, const OurString &s2); friend OurString operator + (const OurString &s1, char c); friend OurString operator + (const OurString &s1, char *s); friend bool operator == (const OurString &s1, const OurString &s2); friend bool operator < (const OurString &s1, const OurString &s2); friend bool operator <= (const OurString &s1, const OurString &s2); friend bool operator > (const OurString &s1, const OurString &s2); friend bool operator >= (const OurString &s1, const OurString &s2); friend istream& operator >> ( istream & ins, OurString &s); friend ostream& operator << ( ostream & outs, const OurString &s); unsigned length(); char * c_str(); }; #endif