#include <iostream>
using namespace std;
class Sing
{
private:
string sing;
public:
Sing(){}
Sing(string s):sing(s)
{
}
void show()
{
cout << sing << endl;
}
};
class Jump
{
private:
string jump;
public:
Jump() {}
Jump(string j):jump(j)
{}
void show()
{
cout << jump << endl;
}
};
class Kun:public Sing,public Jump
{
private:
string rap;
string basketball;
public:
Kun(){}
Kun(string s,string j,string r,string b):Sing(s),Jump(j),rap(r),basketball(b)
{}
void show()
{
cout << rap << endl;
cout << basketball << endl;
cout << "kunkun出场" << endl;
}
};
int main()
{
Kun k1("唱","跳","rap","篮球");
k1.Sing::show();
k1.Jump::show();
k1.show();
return 0;
}
王杰C++day5
最新推荐文章于 2024-09-06 08:50:54 发布