Advertisement
aldinokemal

Kelas - Method

Sep 25th, 2022
1,129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. class Dosen {
  4.     private string $name = "Kenneth";
  5.  
  6.     public function sayHello(): string
  7.     {
  8.         return "Hello {$this->name} selamat pagi!";
  9.     }
  10. }
  11.  
  12. $dosen = new Dosen();
  13. echo $dosen->sayHello();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement