//31用复制构造函数实现字符串的初始化/*#includeusing namespace std;class String{public: String(); //默认的构造函数 String(const char*const ch); //构造带值的string int getlen()const { return len;} //读取长度 const char *getstr()const{ return str;} //读取字符串 //这里是可以修改的 char &operator[](unsigned short int length); char operator[](unsigned short int length)const; //复制构造函数 String (const String&r);private: unsigned short int len; char *str;};//创建一个空的str变量String::String(){ len = 0; str = new char[1]; str[0] = '\0';};String::String(const char*const ch){ cout<<"带一个参数的构造函数"< len){ return str[len-1]; //返回可见字符的值 }else{ return str[length]; }};char String::operator[](unsigned short int length)const{ cout<<"下标运算符const执行"< len){ return str[len-1]; //返回可见字符的值 }else{ return str[length]; }};String::String (const String&rs){ len = rs.getlen(); str = new char[len+1]; for(int i=0; i >s3[999]; cout< < using namespace std;class A{public: A(int i, int j){ x=i; y=j;} void set(int s1, int s2){ x=s1; y=s2;} void print(){cout< <