Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Person {
- private $name; // instance field
- public function setName($name) { // instance method
- $this->name = $name;
- }
- public function getName() { // instance method
- return $this->name;
- }
- public static function getClassName() { // static method
- return "Person: ";
- }
- }
- class Employee extends Person {
- }
- $e = new Employee();
- $e->setName("Eric");
- echo $e->getName();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement