#include <iostream>
#include <istream>
#include <iomanip>
using namespace std;
class Per
{
private:
string name;
int age;
int high;
int write;
public:
Per()
{
cout << "Per::无参" << endl;
}
Per(string name,int age,int high,int write):name(name),age(age),high(high),write(write)
{
cout << "Per::构造函数" << endl;
}
~Per()
{
cout << "Per::析构函数" << endl;
}
};
class Stu
{
private:
double sorce;
Per p1;
public:
Stu()
{
cout << "Stu::无参" << endl;
}
Stu(double sorce,string name,int age,int high,int write):sorce(sorce),p1(name,age,high,write)
{
cout << "Stu::构造函数" << endl;
}
~Stu()
{
cout << "Stu::析构函数" << endl;
}
};
int main()
{
Stu s1(88,"撒大大",17,170,70);
return 0;
}
6.5作业
最新推荐文章于 2024-06-05 23:40:59 发布