You can call methods from a classes's parents like so class foo { protected method bar() { echo "in foo!"; } } class foobar extends foo { public function bar() { parent::bar(); } } $fb = new foobar(); $fb->bar(); will output "in foo!"; On Sun, May 24, 2009 at 3:58 PM, Nathan Rixham <nrixham@xxxxxxxxx> wrote: > Stuart wrote: > >> 2009/5/24 phphelp -- kbk <phphelp@xxxxxxxxxxx>: >> >>> If so, can the bar_handler->bar_toast() function call a function in the >>> container class (foo_handler)? "Parent" is used in some OOP languages for >>> this type of hierarchy, but not PHP. I have fooled around with the scope >>> resolution operator, but either that doesn't do it or I can't nail the >>> syntax. >>> >>> Anyone care to illuminate this for me? >>> >> >> I've never heard of this being possible in any language, never mind >> PHP. The parent keyword you mention refers to the parent class not the >> container, and works just as well in PHP as in other languages. Any >> OOP implementation that allows a class to call functions in a >> container class would be breaking one of the cardinal rules of OOP. >> >> -Stuart >> >> > no offence but it smacks a bit of bad design tbh - however one possibility > is to inject a reference to the container class instance in to the child > > $this->bar_handler = new bar_handler( $this ); > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >