#include <iostream>
using namespace std;
class Per{
private:
string name;
int age;
double* heigh;
double* weight;
public:
Per(){
cout<<"Per::无参构造函数"<<endl;
}
Per(string name,int age,double heigh,double weight):name(name),age(age),heigh(&heigh),weight(&weight){
cout<<"Per::有参构造函数"<<endl;
}
~Per(){
cout<<"Per::无参析构函数"<<endl;
delete heigh;
delete weight;
}
};
class Stu{
private:
double score;
Per p1;
public:
Stu(){
cout<<"Stu::无参构造函数"<<endl;
}
Stu(double score,string name,int age,double heigh,double weight):score(score),p1(name,age,heigh,weight){
cout<<"Stu::有参构造函数"<<endl;
}
~Stu(){
cout<<"Stu::无参析构函数"<<endl;
}
};
int main()
{
Stu s1(100,"lu",18,188,230);
return 0;
}