fork(2) download
  1. <?php
  2.  
  3. class Exemplo {
  4. protected $protegido = 'Protegido';
  5. protected function metodoProtegido() { }
  6. }
  7.  
  8.  
  9. $obj = new Exemplo();
  10. $obj->protegido = 'Teste'; //Erro
  11. $obj->metodoProtegido(); //Erro
Runtime error #stdin #stdout #stderr 0s 82880KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Fatal error:  Uncaught Error: Cannot access protected property Exemplo::$protegido in /home/BHUd18/prog.php:10
Stack trace:
#0 {main}
  thrown in /home/BHUd18/prog.php on line 10