Procházet zdrojové kódy

inheritance classes of geometric shapes

bufon2211 před 6 roky
rodič
revize
3d962a2e59
1 změnil soubory, kde provedl 34 přidání a 0 odebrání
  1. 34 0
      Point.php

+ 34 - 0
Point.php

@@ -0,0 +1,34 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: mrs
+ * Date: 28.12.2017
+ * Time: 9:27
+ */
+require_once('AbstractCoordinates.php');
+
+
+class Point extends Coordinates
+{
+    public $x = 0;
+    public $y = 0;
+
+    public function __construct(int $x, int $y)
+    {
+
+        $this->x = $x;
+        $this->y = $y;
+    }
+
+    public function getCoordinates(): array
+    {
+        $point['x'] = $this->x;
+        $point['y'] = $this->y;
+        return $point;
+    }
+
+    public function printCoordinates(): void
+    {
+        echo "Координаты точки: х = " . $this->x . " y = " . $this->y;
+    }
+}