<?php
class Pai {
protected $protegido = 'Protegido';
protected function metodoProtegido() {
echo 'Método protegido na classe pai';
}
}
class Filha extends Pai {
protected $protegido;
public function acessarAtributoProtegido(){
$this->protegido = 'Valor alterado';
echo $this->protegido;
}
public function chamarMetodoProtegido() {
parent::metodoProtegido();
}
}
PD9waHAKIGNsYXNzIFBhaSB7CiAgcHJvdGVjdGVkICAkcHJvdGVnaWRvID0gJ1Byb3RlZ2lkbyc7CiAgIHByb3RlY3RlZCBmdW5jdGlvbiBtZXRvZG9Qcm90ZWdpZG8oKSB7CgkgIAllY2hvICdNw6l0b2RvIHByb3RlZ2lkbyBuYSBjbGFzc2UgcGFpJzsKCX0KIH0KCiBjbGFzcyBGaWxoYSBleHRlbmRzIFBhaSB7CiAgIHByb3RlY3RlZCAkcHJvdGVnaWRvOwogICAgcHVibGljIGZ1bmN0aW9uIGFjZXNzYXJBdHJpYnV0b1Byb3RlZ2lkbygpewogICAgICAgCSR0aGlzLT5wcm90ZWdpZG8gPSAnVmFsb3IgYWx0ZXJhZG8nOwogICAgICAgCWVjaG8gJHRoaXMtPnByb3RlZ2lkbzsKICAgIH0KICAgIHB1YmxpYyBmdW5jdGlvbiBjaGFtYXJNZXRvZG9Qcm90ZWdpZG8oKSB7CiAgICAgICAJcGFyZW50OjptZXRvZG9Qcm90ZWdpZG8oKTsKICAgIH0KIH0=