fork(2) download
  1. <?php
  2. class Pai {
  3. protected $protegido = 'Protegido';
  4. protected function metodoProtegido() {
  5. echo 'Método protegido na classe pai';
  6. }
  7. }
  8.  
  9. class Filha extends Pai {
  10. protected $protegido;
  11. public function acessarAtributoProtegido(){
  12. $this->protegido = 'Valor alterado';
  13. echo $this->protegido;
  14. }
  15. public function chamarMetodoProtegido() {
  16. parent::metodoProtegido();
  17. }
  18. }
Success #stdin #stdout 0s 82880KB
stdin
Standard input is empty
stdout
Standard output is empty