<?php class Foo { public function func() { echo 'foo'; } } class Bar extends Foo { public function func() { echo 'bar'; } } $obj = new Bar(); $obj->func(); // returns of course 'bar' $parentClassString = get_parent_class($obj); $newObj = new $parentClassString; $newObj->func();
You have javascript disabled. You will not be able to edit any code.