#include using namespace std; class BString { friend ostream& operator<< (ostream& os, const BString& b); friend istream& operator>> (istream& os, BString& b); friend bool operator< (const BString& s1, const BString& s2); friend bool operator> (const BString& s1, const BString& s2); friend bool operator<= (const BString& s1, const BString& s2); friend bool operator>= (const BString& s1, const BString& s2); friend bool operator== (const BString& s1, const BString& s2); friend bool operator!= (const BString& s1, const BString& s2); friend BString operator+(const BString& s1, const BString& s2); public: BString(); // default, set string to empty string BString(const char* s); // create object with the cstring s // conversion constructor ~BString(); // destructor, for dynamic cleanup // to manage copies -- deep copy instead of shallow copy BString(const BString& bs); // copy constructor BString& operator=(const BString& bs); // assignment operator BString& operator+= (const BString& bs); int GetSize() const; // accessor for size attribute private: char* str; // pointer to dynamic array of char // allocation will always be size+1 int size; // size of string void Resize(int newsize); // resize allocation of our string void Clone(const BString& bs); // helper for deep copy };