#include using namespace std; class BString { friend bool operator< (const BString& x, const BString& y); friend bool operator> (const BString& x, const BString& y); friend bool operator<=(const BString& x, const BString& y); friend bool operator>=(const BString& x, const BString& y); friend bool operator==(const BString& x, const BString& y); friend bool operator!=(const BString& x, const BString& y); friend BString operator+(const BString& x, const BString& y); friend ostream& operator<< (ostream& os, const BString& s); friend istream& operator>> (istream& is, BString& s); public: BString(); // default constructor -- sets to empty string BString(const char* c); // conversion FROM c-string to string object BString(int x); // conversion from int to string object ~BString(); // destructor for final cleanup // deep copy functions BString(const BString& s); // copy constructor BString& operator=(const BString& s); // assignment operator int GetSize() const; // retrieve the size of the string BString Substring(int index, int len); // return a substring starting // at index with length len private: char* str; // the pointer to our dynamic array of chars int size; // the size of the string (e.g. "Hello" would be 5) // we will allocate just what we need to store void Resize(int newsize); // resize the string to size "newsize" };