class Point {
var x: Int
var y: Int
init(x: Int, y: Int){
self.x = x
self.y = y
}
}
class Machine {
var location: Point
init() {
self.location = Point(x: 0, y: 0)
}
func move(direction: String) {
print("Do nothing! Im a machine!")
}
}
class Robot: Machine {
overridefunc move(direction: String) {
if direction == "Up" {
location.y += 1
} elseif direction == "Down" {
location.y -= 1
} elseif direction == "Left" {
location.x -= 1
} elseif direction == "Right" {
location.x += 1
}
}
}