设计一个Per类,类中包含私有成员:姓名、年龄、指针成员身高、体重,再设计一个Stu类,类中包含私有成员:成绩、Per类对象p1,设计这两个类的构造函数、析构函数和拷贝构造函数。
Per(string name, int age, double height, double weight);
Stu(double score,string name, int age, double height, double weight);
Per::Per(string name, int age, double height, double weight)
:name(name),age(age),height(new double(height)),weight(new double(weight)){
cout << "Per::有参构造函数" << endl;
:name(per.name),age(per.age),height(new double(*per.height)),weight(new double(*per.weight)){
cout << "Per::拷贝构造函数" << endl;
cout << "Per::析构函数" << endl;
cout << "name = " << name << "\tage = " << age << "\theight = " << *height << "\tweight = " << *weight;
Stu::Stu(double score,string name, int age, double height, double weight)
:score(score),p(name,age,height,weight){
cout << "Stu::有参构造函数" << endl;
Stu::Stu(Stu &stu):score(stu.score),p(stu.p){
cout << "Stu::拷贝构造函数" << endl;
cout << "Stu::析构函数" << endl;
cout << "\tscore = " << score << endl;
Stu s(95.5,"zhang",18,175,120);


