Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class Acount
- {
- string name;
- int money = 0;
- static int bonus;
- public:
- Acount(string name, int money)
- {
- this->name = name;
- this->money = money + bonus;
- }
- static int getBonus() {
- return bonus;
- }
- static void setBonus(int _bonus){
- bonus = _bonus;
- }
- int getMoney() {
- return money;
- }
- };
- int Acount::bonus = 50;
- int main() {
- setlocale(LC_ALL, "Russian");
- Acount c1("Глеб", 20);
- Acount c2("Ярик", 100);
- Acount c3("Фокин", 80);
- cout << c1.getMoney() << endl;
- cout << c2.getMoney() << endl;
- cout << c3.getMoney() << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement