<?php abstract class Foo{ protected function bar(){ echo 'Foo', PHP_EOL; var_dump($this); return $this; } } class Bar extends Foo{ public function foo(){ echo 'Bar', PHP_EOL; var_dump($this); // this should hold Bar instance and not Foo's $barClassInstance = $this->bar(); var_dump($barClassInstance); } } $bar = new Bar(); $bar->foo();
You have javascript disabled. You will not be able to edit any code.