Container or Calling Class

From: Date: Sun, 24 May 2009 17:01:53 +0000
Subject: Container or Calling Class
Groups: php.general 
Request: Send a blank email to php-general+get-293068@lists.php.net to get a copy of this message
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

« previous php.general (#293068) next »