Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Point {
- private:
- int x, y;
- public:
- Point() {
- }
- Point(int x, int y) {
- this->x = x;
- this->y = y;
- }
- Point & operator += (Point tmp) {
- this->x += tmp.x;
- this->y += tmp.y;
- return *this;
- }
- Point & operator -= (Point tmp) {
- this->x -= tmp.x;
- this->y -= tmp.y;
- return *this;
- }
- Point & operator *= (Point tmp) {
- this->x *= tmp.x;
- this->y *= tmp.y;
- return *this;
- }
- Point & operator /= (Point tmp) {
- this->x /= tmp.x;
- this->y /= tmp.y;
- return *this;
- }
- void print() {
- cout << this->x << " " << this->y << endl;
- }
- };
- int main() {
- Point p1(1, 2);
- Point p2(2, 3);
- p1 /= p2;
- p1.print();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement