- Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.27
- Fatal error: Access level to StaticB::dosomething() must be public (as in class StaticA) in /in/V9rPR on line 44
Process exited with code 255.
<?php
class StaticA {
public function setEmail($redirect) {
$this->email = $redirect;
}
protected function returnthis(){
return $this;
}
public function dosomething(){
echo "Unrsprüngliche Methode";
$obj = parent::returnthis();
echo $obj->email;
}
public function classInfo(){
echo get_class(new static). "\n";
echo $this->email. "\n";
}
}
class StaticB extends StaticA {
public function test(){
//echo get_class(new self). "\n";
parent::classInfo();
}
public function doit(){
$this->dosomething();
//echo $this->email. "\n";
}
private function dosomething(){
$obj = parent::returnthis();
echo "Neue Methode!";
echo $obj->email;
}
}
$object = new StaticB();
$object->setEmail("erno@01art.de");
$object->doit();