equal
deleted
inserted
replaced
|
1 #ifndef _POINT_H |
|
2 #define _POINT_H |
|
3 |
|
4 class Point{ |
|
5 public: |
|
6 Point(int xCoord = -1, int yCoord= -1) |
|
7 : fx(xCoord), fy(yCoord) {}; |
|
8 |
|
9 inline int & x(){return fx;} |
|
10 inline int & y() {return fy;}; |
|
11 |
|
12 |
|
13 // Relational operators |
|
14 |
|
15 inline bool operator ==(Point p) |
|
16 { return (fx == p.x() && fy == p.y());}; |
|
17 inline bool operator !=(Point p) |
|
18 { return (fx != p.x() || fy != p.y());}; |
|
19 inline bool operator < (Point p) |
|
20 { return (fx < p.x()) && (fy < p.y()); }; |
|
21 inline bool operator > (Point p) |
|
22 { return (fx > p.x()) && (fy > p.y()); }; |
|
23 inline bool operator <=(Point p) |
|
24 { return (fx <= p.x()) && (fy <= p.y()); }; |
|
25 inline bool operator >=(Point p) |
|
26 { return (fx >= p.x()) && (fy >= p.y()); }; |
|
27 |
|
28 private: |
|
29 int fx; |
|
30 int fy; |
|
31 }; |
|
32 |
|
33 |
|
34 #endif |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |