x = $x; $this->y = $y; } public function getDistance(Coord $coord) { return round(sqrt(pow($coord->x - $this->x, 2) + pow($coord->y - $this->y, 2))); } public function __get($name) { if ($name == 'x' || $name == 'y') { return $this->$name; } else throw new SDGException('Can only access X and Y in ' . __CLASS__); } public function __toString() { return $this->x . ',' . $this->y; } }