-
Notifications
You must be signed in to change notification settings - Fork 0
/
Location.cpp
44 lines (36 loc) · 744 Bytes
/
Location.cpp
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
//The Location class has been provided, there are no changes needed here
#include "Location.h"
Location::Location(){
name = "";
x = 0;
y = 0;
}
Location::Location(string name_, float x_, float y_){
name = name_;
x = x_;
y = y_;
}
Location Location::operator + (Location const &other) {
return Location(name + other.name, x + other.x, y + other.y);
}
bool Location::operator == (Location const &other){
return (name == other.name && x == other.x && y == other.y);
}
void Location::setName(string name_){
name = name_;
}
void Location::setX(float x_){
x = x_;
}
void Location::setY(float y_){
y = y_;
}
string Location::getName(){
return name;
}
float Location::getX(){
return x;
}
float Location::getY(){
return y;
}