
#include <iostream>
#include <string.h>
#include <unistd.h>
using namespace std;
class Father {
private:
int money;
protected:
int room_key;
public:
int address;
void it_skill(void)
{
cout<<"father's it skill"<<endl;
}
int getMoney(void)
{
return money;
}
void setMoney(int money)
{
this->money = money;
}
};
class Son_pub : public Father {
private:
int toy;
public:
void play_game(void)
{
int m;
cout<<"son play game"<<endl;
m = getMoney();
m--;
setMoney(m);
room_key = 1;
}
};
class Son_pro : protected Father {
private:
int toy;
public:
void play_game(void)
{
int m;
cout<<"son play game"<<endl;
m = getMoney();
m--;
setMoney(m);
room_key = 1;
}
};
class Son_pri : private Father {
private:
int toy;
public:
void play_game(void)
{
int m;
cout<<"son play game"<<endl;
m = getMoney();
m--;
setMoney(m);
room_key = 1;
}
};
int main(int argc, char **argv)
{
Son_pub s_pub;
Son_pro s_pro;
Son_pri s_pri;
s_pub.play_game();
s_pro.play_game();
s_pri.play_game();
s_pub.it_skill();
return 0;
}
