cpp
复制代码
#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;
}