Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cmath>
- #include <cstdio>
- #include <vector>
- #include <iostream>
- #include <algorithm>
- #include <string>
- using namespace std;
- class test
- {
- public :
- int x;
- test(const test &obj)
- {
- x = obj.x + 1;
- }
- test(int y)
- {
- x = y;
- }
- test& operator= (const test &obs)
- {
- test tmp(this->x);
- tmp.x = obs.x + 1;
- return tmp;
- }
- };
- int main() {
- test a(1);
- test b(3);
- b = a;
- cout << b.x;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement