- pow: documentation ( source)
<?php
class CP2
{
protected $alas;
protected $miring;
public function set($a,$b)
{
$this->alas = $a;
$this->miring = $b;
echo "Alas: ".$this->alas.'.'."Miring: ".$this->miring.'.';
}
}
class subCP2 extends CP2
{
protected $tinggi;
protected function tinggi()
{
$this->tinggi=(pow($this->miring,2)-pow($this->alas,2));
echo "Tinggi Segitiga: ".$this->tinggi;
}
public function runTinggi()
{
echo $this->tinggi();
}
}
$run = new CP2();
$run = new subCP2();
$run->set(2,6);
$run->runTinggi();
?>