#include <iostream>
using namespace std;
class per
{
private:
string name;
int age;
int *high;
int* weight;
public:
per(){cout << "wu can" << endl;}
per(string name,int age,int high,int weight):name(name),age(age),high(new int(high)),weight(new int(weight))
{
cout << "you can" << endl;
}
~per()
{
cout << "xi gou" << endl;
delete high;
delete weight;
}
};
class stu
{
private:
double score;
per p1;
public:
stu(){cout << "stu wu" << endl;}
stu(double score,string name,int age,int high,int weight):score(score),p1(name,age,high,weight)
{
cout << "stu you" << endl;
}
~stu()
{
cout << "stu xi" <<endl;
}
};
int main()
{
per p1;
per("z",18,180,80);
stu(88,"x",28,188,88);
return 0;
}
605作业
于 2024-06-05 20:07:32 首次发布