Stuart wrote:
2009/5/24 phphelp -- kbk <>:
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

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.


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 (
To unsubscribe, visit:

Reply via email to