-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPoint.cpp
46 lines (38 loc) · 878 Bytes
/
Point.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// Benjy Berkowicz - 336182589
// Advanced Programming 2016-2017 Bar Ilan
//
#include "Point.h"
using namespace std;
Point::Point(int setX, int setY) {
x = setX;
y = setY;
}
Point::Point() {
// Default construction into points -1 and -1
x = -1;
y = -1;
}
/**
* Takes a point with x and y members and turns it into the string (x,y)
*/
string Point::toString() {
stringstream returnString;
returnString << "(" << x << "," << y << ")";
return returnString.str();
}
/**
* Compares two points on their x and y values, if they are equal true is returned, else false.
*/
bool Point::operator==(Point& other) {
return ((x == other.x) && (y == other.y));
}
/**
* Sees if two points are not equal
*/
bool Point::operator!=(Point& other) {
return ((x != other.x) || (y != other.y));
}
int Point::distanceTo(Point) {
return 0;
}