#php #pemograman-berorientasi-objek-di-php #dasar-pemograman-berorientasi-objek-pbo-di-php
Petunjuk Diskusi
Semoga bermanfaat class Handphone { public $kamera; public $tahun; public $layar_sentuh = true; public function __construct($kamera, $tahun){ $this->kamera = $kamera; $this->tahun = $tahun; } public function ambil_photo(){ return "$this->kamera jepret"; } } $canggih = new Handphone(" kamera: 8 megapixels", "tahun :2013" ); $jadul = new Handphone( "kamera :2 Megapixels", "tahun :2012" ); $jadul = new Handphone(true); $jadul->layar_sentuh = false; echo $canggih->ambil_photo();
1 jempol