Files
php_8/methods/construct_params.php
2022-05-03 11:26:20 +03:00

25 lines
415 B
PHP

<?php
class Point {
private $x;
private $y;
public function __construct(int $x, int $y)
{
$this->x = $x;
$this->y = $y;
}
public function getX() : int
{
return $this->x;
}
public function getY() : int
{
return $this->y;
}
public function distance() : float
{
return sqrt($this->getX() ** 2 + $this->getY() ** 2);
}
}