<?php class Exemplo { protected $protegido = 'Protegido'; protected function metodoProtegido() { } } $obj = new Exemplo(); $obj->protegido = 'Teste'; //Erro $obj->metodoProtegido(); //Erro
Standard input is empty
Standard output is empty
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