Advertisement
mvsp

Aula 9

Jul 21st, 2021
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.41 KB | None | 0 0
  1. <?php
  2.  
  3. class Pessoa{
  4.     const nome = "Marcos";
  5.     public function exibirNome(){
  6.         echo self::nome;
  7.     }
  8. }
  9.  
  10. class Marcos extends Pessoa{
  11.  
  12.     const nome = "Vinicius";
  13.  
  14.     public function exibirNome(){
  15.         echo self::nome;
  16.     }
  17.  
  18.     /*public function exibirNome(){
  19.         echo parent::nome;
  20.     }*/
  21.  
  22. }
  23.  
  24. $pessoa = new Pessoa;
  25.  
  26. $pessoa->exibirNome(); echo "<hr>";
  27.  
  28. $marcos = new Marcos;
  29. $marcos->exibirNome(); echo "<hr>";
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement