#php #pemograman-berorientasi-objek-di-php #dasar-pemograman-berorientasi-objek-pbo-di-php
Petunjuk Diskusi
class Kucing { public $lucu = true; public $warna; public $nama; public $umur; public function __construct($warna , $nama , $umur) { $this->warna = $warna; $this->nama = $nama; $this->umur = $umur; } public function hasil() { return "saya punya kucing , namanya $this->nama umurnya kini sudah $this->umur tahun dan warna kulitnya $this->warna"; } } $hasil = new Kucing ('hitam' , 'yakucing' , '1000'); echo $hasil->hasil();
3 jempol