Reputation: 299
I'm trying to become more competent with php. I have a question about parent classes. In the code below is there a way to call function foobar()
from class a within the $b
instantiation. Thanks
<?php
class foo {
function callFooBar(){$this->foobar();}
function foobar(){echo('foobar of foo');}
}
class bar extends foo {
function foobar(){echo('foobar of bar');}
}
$b=new bar;
$b->foobar();
echo("<br>");
$b->callFooBar();
?>
Upvotes: 0
Views: 61