SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. abstract class Bird
  4. {
  5.    abstract public function getName();    
  6. }
  7.  
  8. interface IFlayer
  9. {
  10.   public function fly(): int;
  11. }
  12.  
  13. interface ISwimmer
  14. {
  15.   public function swim(): int;
  16. }
  17.  
  18. class Duck extends Bird implements IFlayer, ISwimmer {
  19.     public function getName(): string
  20.     {
  21.       return 'Donald Duck';
  22.     }  
  23.    
  24.     public function fly(): int
  25.     {
  26.       return 10;
  27.     }
  28.    
  29.     public function swim() : int
  30.     {
  31.       return 3;
  32.     }
  33. }
  34.  
  35. $duck = new Duck();
  36. echo $duck->getName() . PHP_EOL;
  37. echo $duck->swim() . PHP_EOL;
  38. echo $duck->fly() . PHP_EOL;
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