Container or Calling Class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey -- folks -- -- -

I am trying to figure out one aspect of PHP's object model.

Is it good practice to have a class be a property of another class? In other words:

class foo_handler {
	function add_bar() {
		include bar_class.inc;
		$this->bar_handler = new bar_handler;
	}

}

So one would have language in a foo_handler function like:

$this->bar_handler->bar_toast("Rye",$settings);

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?

Many thanks to all of the contributors to this list for all you do...

Ken

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux