Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Билет 24
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- class first
- {
- private:
- int a;
- public:
- first(int aa) :a(aa)
- {
- cout << "Work!" << endl;
- }
- ~first()
- {
- cout << "Destructor!" << endl;
- }
- int& operator++()
- {
- a+=10;
- return a;
- }
- int operator++(int)
- {
- int tmp = a;
- a+=10;
- return tmp;
- }
- void show()
- {
- cout << a << endl;
- }
- void show2()
- {
- cout << a++ << endl;
- }
- };
- int main()
- {
- first a(5);
- ++a;
- a.show();
- a.show2();
- a.show2();
- return 0;
- }
Add Comment
Please, Sign In to add comment