Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.38 KB | None | 0 0
  1. <?php
  2.  
  3. abstract class Person {
  4.  
  5.   abstract public function getName();
  6.  
  7.   public function getIntroduction() {
  8.     return sprintf(
  9.       __('My name is %s'),
  10.       $this->getName()
  11.     );
  12.   }
  13. }
  14. // Person cannot be instantiated
  15.  
  16. class Manuel extends Person {
  17.  
  18.   public function getName() {
  19.     return 'Manuel';
  20.   }
  21. }
  22.  
  23. // Manuel can be instantiated
  24. $manuel = new Manuel();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement