-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSquare.php
More file actions
35 lines (32 loc) · 722 Bytes
/
Square.php
File metadata and controls
35 lines (32 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
class Square extends Rectangle
{
public function __construct($height)
{
parent::__construct($height, $height);
}
public function perimeter()
{
return $this->getHeight() * 4;
}
public function area()
{
return pow($this->getHeight(), 2);
}
}
// class Square extends Rectangle
// {
// public function __construct($height)
// {
// parent:: __construct ($height, $height);
// }
// public function getPerimeter()
// {
// // return ($this->width * 2) + ($this->height * 2) ;
// return pow ($this->height() , 2);
// }
// public function getArea()
// {
// return $this->height * 4;
// }
// };