Point.php 633 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: mrs
  5. * Date: 28.12.2017
  6. * Time: 9:27
  7. */
  8. require_once('AbstractCoordinates.php');
  9. class Point extends Coordinates
  10. {
  11. public $x = 0;
  12. public $y = 0;
  13. public function __construct(int $x, int $y)
  14. {
  15. $this->x = $x;
  16. $this->y = $y;
  17. }
  18. public function getCoordinates(): array
  19. {
  20. $point['x'] = $this->x;
  21. $point['y'] = $this->y;
  22. return $point;
  23. }
  24. public function printCoordinates(): void
  25. {
  26. echo "Координаты точки: х = " . $this->x . " y = " . $this->y;
  27. }
  28. }