daily pastebin goal
23%
SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. class Person {
  4.   private $name; // instance field
  5.  
  6.   public function setName($name) { // instance method
  7.       $this->name = $name;
  8.   }
  9.   public function getName() { // instance method
  10.       return $this->name;
  11.   }
  12.   public static function getClassName() { // static method
  13.       return "Person: ";
  14.   }
  15. }
  16.  
  17. class Employee extends Person {
  18.  
  19. }
  20.  
  21. $e = new Employee();
  22. $e->setName("Eric");
  23. echo $e->getName();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top