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