#include#include using namespace std;class Student1{int no;char *pname;public:Student1(){};//默认构造函数Student1(int n,char *p)//重载构造函数{no=n;pname=new char[10];//不用new分配空间时会出错strcpy(pname,p);}Student1(Student1 &s)//拷贝构造函数{no=s.no;pname=s.pname;}void display(){cout<<"no:"< <<",name:"<<(int)pname< <<" pname:"<<(int)pname< #include using namespace std;class Student2{int no;char *pname;public:Student2(){};//默认构造函数Student2(int n,char *p)//重载构造函数{no=n;pname=new char[10];//不用new分配时会报错strcpy(pname,p);}Student2(Student2&s)//赋值构造函数{no=s.no;pname=new char[strlen(s.pname)+1];//最后面要存个\0,使内存区域不同,strcpy(pname,s.pname);}void display(){cout<<"no:"< <<",name:"< < <<" pname:"<<(int)pname< using namespace std;class CExample {private: int a;public: CExample(int b) { a=b;} void Show () { cout< < using namespace std;class CExample {private: int a;public: CExample(int b) { a=b;} CExample(const CExample& C) { a=C.a; } void Show () { cout< <using namespace std;class CA{ public: CA(int b,char* cstr) { a=b; str=new char[b]; strcpy(str,cstr); } CA(const CA& C) { a=C.a; str=new char[a]; //深拷贝 if(str!=0) strcpy(str,C.str); } void Show() { cout< <