Advertisement
ujiajah1

Finish Dasar Pemograman Berorientasi Objek (PBO) di PHP

Aug 28th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. <?php
  2. class handphone {
  3.  public $kamera;
  4.  public $tahun;
  5.  public $layar_sentuh = true;
  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("kamera : 8 Megapixels", "tahun : 2013");
  15. $jadul = new handphone("kamera : 2 Megapixels", "tahun : 2012");
  16. $jadul->layar_sentuh = false;
  17. echo $canggih->ambil_photo();
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement