Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- class loc
- {
- int a,b;
- public:
- loc(int x,int y):a(x),b(y){}
- loc operator+(loc &t)
- {
- this->a+=t.a;
- this->b+=t.b;
- return *this;
- }
- loc operator,(loc &t)
- {
- return t;
- }
- void show()
- {
- std::cout<<a<<" "<<b<<"\n\n";
- }
- };
- int main()
- {
- loc obj1(1,2),obj2(3,4),obj3(5,6);
- obj1.show();
- obj2.show();
- obj3.show();
- obj1=(obj1,obj2+obj3,obj3);
- obj1.show();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement