- Output for 5.6.38, 7.1.0 - 7.1.23, 7.2.0 - 7.2.11
- Fatal error: Access level to ChildClass::publicGetter() must be public (as in class ParentClass) in /in/g7et5 on line 13
Process exited with code 255.
<?php
class ParentClass {
public function publicGetter() {
return 'pubic getter';
}
}
class ChildClass extends ParentClass {
protected function publicGetter() {
return 'protected getter';
}
}
$foo = new ChildClass();
echo $foo->publicGetter();