#include <iostream>
using namespace std;
class Stu
{
string name;
int age;
int score;
int *high;
public:
Stu(string name,int age,int score,int high):name(name),age(age),score(score),high(new int (high))
{
}
Stu(const Stu &other)
{
this->age=other.age;
this->name=other.name;
this->score=other.score;
high=new int(*(other.high));
cout <<"拷贝构造"<<endl;
}
~Stu()
{
delete this->high;
}
void show()
{
cout <<"姓名:"<<name<<",年龄:"<<age<<",分数:"<<score<<",身高:"<<*high<<endl;
}
};
int main()
{
Stu *stu1=new Stu("lisi",18,100,180);
stu1->show();
Stu stu2=*stu1;
stu2.show();
return 0;
}