mvsp

aula 6

Jul 21st, 2021
37
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. class Veiculo{
  3.     protected $modelo;
  4.     public $cor;
  5.     private $ano;
  6.  
  7.     public function Andar(){
  8.         echo $this->modelo." andou";
  9.     }
  10.  
  11.     public function Parar(){
  12.         echo $this->modelo." parou";
  13.     }
  14.  
  15.     //Setters
  16.     public function setModelo($m){
  17.         $this->modelo = $m;
  18.     }
  19.  
  20.     public function getModelo(){
  21.         return $this->modelo;
  22.     }
  23.  
  24. }
  25.  
  26.  
  27. class Moto extends Veiculo{
  28.     public function empinar(){
  29.         echo $this->modelo." Empinando";
  30.     }
  31. }
  32.  
  33. $moto = new Moto();
  34. $moto->setModelo("CB300");
  35. echo $moto->getModelo();
  36.  
  37. echo "<br>";
  38. var_dump($moto);
  39. echo "<br>";
  40.  
  41.  
RAW Paste Data