Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Human
- {
- private $name;
- public function __construct($name)
- {
- $this->name = $name;
- }
- public function touch($human)
- {
- $human->name = "Ahtung";
- return "Touched $human->name";
- }
- public function getName()
- {
- return $this->name;
- }
- }
- $john = new Human("John");
- $sully = new Human("Sully");
- $john->touch($sully); // Touched Sully
- echo $sully->getName();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement