Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- interface ShapeInterface
- {
- public function area(): int;
- }
- class Rectangle implements ShapeInterface
- {
- private $a;
- private $b;
- public function __construct($a, $b)
- {
- $this->a = $a;
- $this->b = $b;
- }
- public function area(): int
- {
- return $this->a * $this->b;
- }
- }
- class Triangle implements ShapeInterface
- {
- private $r;
- public function __construct($r)
- {
- $this->r = $r;
- }
- public function area(): int
- {
- return pi() * pow($this->r, 2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement