-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoint.h
More file actions
59 lines (47 loc) · 1.37 KB
/
Point.h
File metadata and controls
59 lines (47 loc) · 1.37 KB
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
//
// Created by duni on 21/01/2020.
//
#ifndef PROBLEMSOLVER_POINT_H
#define PROBLEMSOLVER_POINT_H
#include <cmath>
class Point {
private:
int x;
int y;
public:
// This is a constructor function
Point(int x, int y) {
this->x = x;
this->y = y;
}
// This function returns the x coordinate of the current node
int getX() const {
return this->x;
}
// This function returns the y coordinate of the current node
int getY() const {
return this->y;
}
// This function sets the x coordinate of the current node
void setX(int x) {
this->x = x;
}
// This function sets the y coordinate of the current node
void setY(int y) {
this->y = y;
}
// This function preforms the equal operator between the current point and a given point
bool operator==(const Point &other) const {
return this->getX() == other.getX() && this->getY() == other.getY();
}
// This function checks if the current point is equal to the given point
bool Equals(Point *other) {
return this->getX() == other->getX() && this->getY() == other->getY();
}
// This function preforms placement of a given point to the current point
void operator=(const Point &other) {
this->x = other.getX();
this->y = other.getY();
}
};
#endif //PROBLEMSOLVER_POINT_H