Advertisement
montimaj

SS

Feb 25th, 2014
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include<iostream>
  2. class loc
  3. {
  4.   int a,b;
  5. public:
  6.   loc(int x,int y):a(x),b(y){}
  7.   loc operator+(loc &t)
  8.   {
  9.      this->a+=t.a;
  10.      this->b+=t.b;
  11.      return *this;
  12.   }
  13.   loc operator,(loc &t)
  14.   {
  15.     return t;
  16.   }
  17.   void show()
  18.   {
  19.     std::cout<<a<<" "<<b<<"\n\n";
  20.   }
  21. };
  22. int main()
  23. {
  24.   loc obj1(1,2),obj2(3,4),obj3(5,6);
  25.   obj1.show();
  26.   obj2.show();
  27.   obj3.show();
  28.   obj1=(obj1,obj2+obj3,obj3);  
  29.   obj1.show();
  30.   return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement