#include #include using namespace std; class mystr { string myString; public: void buildstr(string aString); // public void showstr(); // constructor mystr::mystr(); }; mystr::mystr() { myString = ""; } void mystr::showstr() { cout << myString << endl; } void mystr::buildstr(string literal) { myString = myString + literal; // myString += literal; } int main() { mystr theString; theString.buildstr("Hello "); theString.buildstr("World!"); theString.showstr(); // The following will not work. Why? // theString.myString = "Hello World!"; // cout << theString.myString; return 0; }