-
Notifications
You must be signed in to change notification settings - Fork 1
/
point.h
41 lines (33 loc) · 868 Bytes
/
point.h
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
/**
* File: point.h
* This class provides a two-dimensional representation of a
* Cartesian point with an x co-ordinate and a y co-ordinate.
* It has functionality to determine the distance between
* two instances of Point objects.
*/
#ifndef POINT_H
#define POINT_H
#include <iostream>
using namespace std;
class Point {
public:
/**
* Constructor that sets the x and y coordinates for the Point object.
*/
Point(double, double);
/**
* Returns the Euclidean distance between this Point and the Point* parameter to the function.
*/
double distanceTo(Point*);
/**
* Produces a string representation of this Point. e.g."2 13".
*/
friend ostream& operator<<(ostream&, Point&);
private:
/**
* X and Y coordinate variables for our Point.
*/
double xCoordinate;
double yCoordinate;
};
#endif // POINT_H