Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Account
- {
- string nick;
- int money;
- static int bonus;
- public:
- Account(string nick, int money)
- {
- this->nick = nick;
- this->money = money+bonus;
- }
- static int getBonus()
- {
- return bonus;
- }
- static void setBonus(int _bonus)
- {
- bonus = _bonus;
- }
- void showinfo()
- {
- cout << nick << endl;
- cout << money << endl;
- cout << bonus << endl;
- }
- };
- int main(){
- int Account::bonus = 200;
- int main(){
- Account p1("Sanya", 0);
- Account p2("Yura", 100);
- Account p3("Gleb", 50);
- Account setBonus();
- Account getBonus();
- p1.showinfo();
- p2.showinfo();
- p3.showinfo();
- return 0;
- }
Add Comment
Please, Sign In to add comment