SHARE
TWEET

Untitled

a guest Mar 20th, 2017 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. class Human
  4. {
  5.     private $name;
  6.  
  7.     public function __construct($name)
  8.     {
  9.         $this->name = $name;
  10.     }
  11.  
  12.     public function touch($human)
  13.     {
  14.         $human->name = "Ahtung";
  15.         return "Touched $human->name";
  16.     }
  17.  
  18.     public function getName()
  19.     {
  20.         return $this->name;
  21.     }
  22. }
  23.  
  24. $john = new Human("John");
  25.  
  26. $sully = new Human("Sully");
  27.  
  28. $john->touch($sully); // Touched Sully
  29.  
  30. echo $sully->getName();
RAW Paste Data
Top