-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoint.h
More file actions
31 lines (24 loc) · 647 Bytes
/
Copy pathPoint.h
File metadata and controls
31 lines (24 loc) · 647 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
#ifndef POINT_H
#define POINT_H
#include <iostream>
class Point
{
// Overloaded stream insertion oeprator
friend std::ostream& operator<<(std::ostream&, Point&);
// Overloaded stream extraction operator
friend std::istream& operator>>(std::istream&, Point&);
private:
double x;
double y;
double distance{ 0 };
public:
Point(double xCor = 0, double yCor = 0); // set x and y
double getX() { return x; };
double getY() { return y; };
double getDistance() { return distance; };
// Overload the addition operator
void operator+(const Point& P2);
// Overload the eqality operator
bool operator==(const Point& P2) const;
};
#endif