#php #pemograman-berorientasi-objek-di-php #dasar-pemograman-berorientasi-objek-pbo-di-php
Petunjuk Diskusi
1
class Handphone {
2
public $kamera;
3
public $tahun;
4
public $layar_sentuh = true;
5
6
public function __construct($kamera, $tahun) {
7
$this->kamera = $kamera;
8
$this->tahun = $tahun;
9
}
10
public function ambil_photo() {
11
return "$this->kamera jepret..!!";
12
}
13
}
14
$canggih = new Handphone("8 Megapixel", 2013);
15
$jadul = new Handphone("2 Megapixel", 2012);
16
17
$jadul->layar_sentuh = false;
18
19
echo $canggih->ambil_photo();
//ini kesalahannya di mana....????
0 jempol
ur__DNA
131
53
·
9 tahun, 1 bulan yang lalu
·
1 jempol
hai coder @muzakki salam diskusi, untuk tugas tersebut sudah pernah diulas di sini : https://codesaya.com/diskusi/d/m... atau sebagai tambahan ulasan di sini : https://codesaya.com/diskusi/php... semoga bisa lanjut. salam codesaya, happycoding!