-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoint.h
More file actions
47 lines (33 loc) · 1003 Bytes
/
point.h
File metadata and controls
47 lines (33 loc) · 1003 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
#ifndef POINT_H
#define POINT_H
class Point
{
public:
//Constructors
Point();
Point(int x, int y);
Point(const int*); //from an array
Point(const Point&);
//Destructor
virtual ~Point();
//Access Methods:
inline double x() const { return fX; }
inline double y() const { return fY; }
inline double X() const { return fX; }
inline double Y() const { return fY; }
inline void SetX(int xx) { fX = xx; }
inline void SetY(int yy) { fY = yy; }
inline void SetXY(int xx, int yy) { fX = xx; fY = yy; }
inline void SetXY(const Point& p) { fX = p.fX; fY = p.fY; }
//Translation
void Translate(int xx, int yy) { fX += xx; fY += yy; }
void Translate(const Point& p) { fX += p.fX; fY += p.fY; }
//Print
void Print() const;
//Will add other methods when needed.
private:
int fX,fY;
};
//Operators
bool operator == (const Point&, const Point&);
#endif // POINT_H