Advertisement
Gleidson_21

poliformismo

Jul 30th, 2021
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.32 KB | None | 0 0
  1. <?php
  2.  
  3. class Animal {
  4.     public function Andar(){
  5.         echo "O animal andou";
  6.     }
  7.  
  8.     public function Correr(){
  9.         echo "O animal correu";
  10.     }
  11. }
  12.  
  13. class Cavalo extends Animal {
  14.  
  15.     public function Andar(){
  16.         $this->Correr();
  17.     }
  18. }
  19.  
  20. $animal = new Cavalo();
  21. $animal->Andar();
  22.  
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement