fork download
  1. <?php
  2.  
  3. // your code goes here
  4.  
  5. class person {
  6. var $name;
  7.  
  8. function __construct($persons_name)
  9. {
  10. $this->name = $persons_name;
  11. }
  12.  
  13. function set_name($new_name)
  14. {
  15. $this->name = $new_name;
  16. }
  17.  
  18. function get_name()
  19. {
  20. return $this->name;
  21. }
  22. }
  23.  
  24. class employee extends person
  25. {
  26. function __construct($employee_name)
  27. {
  28. $this->set_name($employee_name);
  29. }
  30. }
  31.  
  32. $stefan = new person("Stefan Mischook");
  33. echo "Stefan's full name: " . $stefan->get_name();
  34. echo '<br>';
  35. $james = new employee("Johnny Fingers");
  36. echo "new employee---> " . $james->get_name();
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Stefan's full name: Stefan Mischook<br>new employee---> Johnny Fingers