Re: [PHP] Container or Calling Class

2009-05-24 Thread Eddie Drapkin
No problem mate :) As a general rule, it seems that PHP just copied Java's OOP model - and outside of the quirks in the way it works internally - it's a pretty damn good implementation of object orientation. THe only issue I have with it is that it's not possible to lose the procedural bootstrapp

Re: [PHP] Container or Calling Class

2009-05-24 Thread Eddie Drapkin
That's containment, not inheritence, must have misread the email. Oops :) The "easiest" way to do this would be something like: class contrived { private $parent; private $otherparent; public function __call($func, $params) { if(is_callable(array($this->parent, $func)) call_user_func_array(arra

Re: [PHP] Container or Calling Class

2009-05-24 Thread Nathan Rixham
Eddie Drapkin wrote: 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!"; wrong way round.. he's asking f

Re: [PHP] Container or Calling Class

2009-05-24 Thread Eddie Drapkin
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 wrote:

Re: [PHP] Container or Calling Class

2009-05-24 Thread Nathan Rixham
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

Re: [PHP] Container or Calling Class

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

[PHP] Container or Calling Class

2009-05-24 Thread phphelp -- kbk
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 = ne