Hi everyone, im trying to print getAktiva() but it return an error:
"Fatal error: Call to protected method indukPerusahaanABC::getAktiva() from context '' in C:\xampp\htdocs\sad.php on line 41"
Thanks in advance
<?php
class indukPerusahaanABC{
protected $nama;
protected $jenis;
protected $alamat;
private $aktivaLancar;
private $aktivaTetap;
public function __construct($nama, $jenis, $alamat){
$this->nama = $nama;
$this->jenis = $jenis;
$this->alamat = $alamat;
$this->aktivaLancar = 35000000000;
$this->aktivaTetap = 55000000000;
}
public function getNama(){
return $this->nama;
}
public function getJenis(){
return $this->jenis;
}
public function getAlamat(){
return $this->alamat;
}
protected function getAktiva(){
return $this->aktivaLancar+$this->aktivaTetap;
}
}
$induk = new indukPerusahaanABC('CBA', 'Kredit', 'Jakarta Pusat');
echo "Perusahaan Induk: ".$induk->getNama()."<br/>";
echo "Bidang Area/Pekerjaan: ".$induk->getJenis()."<br/>";
echo "Alamat Perusahaan Induk: ".$induk->getAlamat()."<br/>";
echo "Aktiva Perusahaam Induk: Rp ".$induk->getAktiva()."<br/>";
?>