-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoint2d.cpp
More file actions
61 lines (45 loc) · 819 Bytes
/
Point2d.cpp
File metadata and controls
61 lines (45 loc) · 819 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
50
51
52
53
54
55
56
57
58
59
60
61
#include "Point2d.h"
#include<sstream>
Point2d::Point2d() {
_x = 0;
_y = 0;
}
Point2d::Point2d(const int x,const int y){
_x = x;
_y = y;
}
Point2d::Point2d(const Point2d& orig) {
_x = orig._x;
_y = orig._y;
}
int Point2d::getX()
{
return _x;
}
int Point2d::getY()
{
return _y;
}
void Point2d::setX(const int x)
{
_x=x;
}
void Point2d::setY(const int y)
{
_y=y;
}
string Point2d::toString() {
std::ostringstream oss;
oss<< "("<<_x<<" "<<_y<<")";
return oss.str();
}
Point2d* Point2d::operator =(const Point2d& p){
this->_x = p._x;
this->_y = p._y;
return this;
}
bool Point2d::isEqual(const Point2d* p)
{
if (this->_x == p->_x && this->_y == p->_y)return true;
return false;
}