Advertisement
Geicy

Untitled

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