-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoint.cpp
More file actions
52 lines (36 loc) · 756 Bytes
/
Copy pathPoint.cpp
File metadata and controls
52 lines (36 loc) · 756 Bytes
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
47
48
49
#include "Point.h"
Point::Point() : _xVal(0), _yVal(0), _pointStr("")
{
}
Point::Point(int xNum, int yNum) : _xVal(xNum), _yVal(yNum),
_pointStr(std::to_string(_xVal) + "," + std::to_string(_yVal))
{
}
Point::Point(const Point& other) : Point(other._xVal, other._yVal)
{
}
Point::~Point()
{
}
std::string Point::toString() const
{
return _pointStr;
}
void Point::set(const int xNum, const int yNum)
{
_xVal = xNum;
_yVal = yNum;
}
bool Point::operator==(Point& other) const
{
// If string compare ==0, then strings are equal, hence points are equal.
return _pointStr.compare(other._pointStr) == EQ_POINTS;
}
int Point::getXVal() const
{
return _xVal;
}
int Point::getYVal() const
{
return _yVal;
}