For example:
<?php
class animal {
private $property = "animal";
public function whoami() {
return "I am an " . $this->property . ".\n";
}
}
class emu extends animal {
private $property = "emu";
}
$emu = new emu;
echo $emu->whoami(); // "I am an animal"
The above code will report "I am an animal", but I would like it to report "I am an emu", without needing to override the whoami() method.
Is there any way of doing this in PHP?