#include<iostream>
#include<string>
using namespace std;
class Parent {
public:
Parent(const string& name, int age): name(name),age(age) {
cout << "Parent构造函数被调用" << endl;
}
~Parent() {
cout << "Parent的析构函数" << endl;
}
void show()
{
cout<<"Parent::paa"<<paa<<endl;
cout<<"这是父亲的show"<<endl;
}
private:
string name;
int age;
class Student:public Parent
{
private:
int socre;
public:
Student(const string& name, int age, const string& activity)
: Human(name, age), int socre {
cout << "Student构造函数被调用" << endl;
}
// 析构函数
~Student() {
cout << "Student的析构函数" << endl;
}
class Party : public Human { // 子类继承为公共的
private:
string activity// 党员类的私有成员变量
string organization
public:
// 构造函数
Party(const string& name, int age, const string& activity,const string& organization
: Human(name, age), party(activity) {
cout << "Party构造函数被调用" << endl;
}
// 析构函数
~Party() {
cout << "Party的析构函数" << endl;
}
class position:public Student,public Patry
class Position : public virtual Student, public virtual PartyMember {
public:
// 构造函数
Position(const string& name, int age, int score, const string& activity, const string& org)
: Student(name, age, score), PartyMember(name, age, activity, org) {
cout << "Position构造函数被调用" << endl;
}
// 析构函数
~Position() {
cout << "Position的析构函数" << endl;
}
int main(int argc, const char *argv[])
{
Position pos("Alice", 26, 95, "热爱生活", "青少年团队");
return 0;
}