Override, then ask the parent
One child keeps the parent's hello(), the other overrides it and still calls the parent.
<?phpclass Greeter { public function hello(): string { return "Hello"; }}class LoudGreeter extends Greeter { public function hello(): string { return strtoupper(parent::hello()) . "!"; }}class QuietGreeter extends Greeter {}echo (new QuietGreeter())->hello(), "\n";echo (new LoudGreeter())->hello(), "\n";1. Predict the output
Tap the lines in the order you think they print.
- 1…
- 2…