Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'init.php';
- class Manusia implements GayaHidup {
- private $nama;
- private $gender;
- private $tanggal_lahir;
- public function setNama($nama){
- $this->nama = $nama;
- }
- public function getNama(){
- return $this->nama;
- }
- public function setGender($gender){
- $this->gender = $gender;
- }
- public function getGender(){
- return $this->gender;
- }
- public function setTanggal_lahir($tanggal_lahir){
- $this->tgl_lahir = $tanggal_lahir;
- }
- public function getTanggal_lahir(){
- return $this->tgl_lahir;
- }
- public function usia(){
- $date = date_create_from_format("d/m/Y", $this->tgl_lahir);
- $tahun_lahir = $date->format('Y');
- $tahun_sekarang = date('Y');
- $usia = $tahun_sekarang - $tahun_lahir;
- return $usia;
- }
- public function berbicara(){
- echo "awoakwoakwoakwoa";
- }
- public function bernafas(){
- echo "hmmm.... bau ...";
- }
- public function makan(){
- echo "hmmm... daging skubidu";
- }
- public function berjalan(){
- echo "Pletak ... pletuk...";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment