Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class A {
- int k;
- public:
- A(const int i = 0) :k(i) { cout << 'k'; }
- A(const A& a) { k = a.k; cout << 'c'; }
- void operator=(A &a) { k = a.k; f(a); cout << 'e'; }
- A &operator*(int i) { cout << i*100; return *this; }
- void f(A a) { k++; cout << 'f'; }
- ~A() { cout << 'd'; }
- };
- A &operator*(int i, A& a) { cout << i; return a; }
- int main() {
- A a = A(1); cout << '\n';
- a = a * 2; cout << '\n';
- a = 3 * a; cout << '\n';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement