1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| #include <iostream> #include "mystring.h" using namespace std;
int main(int argc, char *argv[]) { myString str1("hello str1"); cout<<"str1:"<<str1<<",length:"<<str1.length()<<endl;
myString str2 = str1; cout<<"str2:"<<str2<<",length:"<<str2.length()<<endl;
myString str3; str3 = str1; cout<<"str3:"<<str3<<",length:"<<str3.length()<<endl;
myString str4 = "hello str4"; cout<<"str4:"<<str4<<",length:"<<str4.length()<<endl; return 0; }
|