Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
865 B
3
Indexable
Never
<?php

abstract class Shape
{
    protected $area;
    protected $perimeter;
    abstract public function getArea();
}
class Triangle extends Shape
{
    private $base;
    private $height;
    private $vatar;
    public function getArea()
    {
    }
    public function __construct($base, $height, $vatar)
    {
        $this->setSides($base, $height, $vatar);
    }
    public function setSides($base, $height, $vatar)
    {
        if ($vatar > $base && $vatar > $height) {
            $this->base = $base;
            $this->height = $height;
            $this->vatar = $vatar;
        }
    }
    public function areaTrianlge()
    {
        $this->area = ($this->base * $this->height) / 2;
    }
    public function perimeterTrianlge()
    {
        $this->perimeter = $this->base + $this->height + $this->vatar;
    }
}