is there any work around to access the parents values that ware overwritten by child?
parent::$prop: expect to be static. and the same with: self::$prop
class base {
public $name = 'base';
public function __construct()
{
echo $this->name . "\n";
echo self::$name . "\n";
}
}
class sub extends base {
public $name = 'sub';
public function __construct()
{
parent::__construct(); // output: sub
// Fatal error
echo $this->name . "\n"; // output: sub
echo parent::$name . "\n"; // Fatal error
}
}
new sub();