see below for comments

        Tim Ward
        Senior Systems Engineer

Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html


> -----Original Message-----
> From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, October 25, 2001 11:56 AM
> To:   Tim Ward; [EMAIL PROTECTED]
> Subject:      RE: PHP object communication
> 
> Hi Tim,
> 
> > If you want access to error functions within the db class it must either
> > extend the error class or have an error object within it. Either ...
> >
> I'll go for the latter, because extends isn't appropriate in this case:
        [Tim Ward]  I think I would use the second option in your case as
well, but always consider inheritance, it's beter where it is appropriate

> > Class DB
> > {   var $error;
> > ...
> >     function DB() // constructor
> >     {       ...
> >             $this->error = new Error();
> >     }
> > ...
> > }
> >
> > Class Core
> > {   var $db;
> >     var error;
> >
> >     function Core() // constructor
> >     {       ...
> >             $this->db = new DB();
> >             $this->error = new Error();
> >             ...
> >     }
> > }
> >     at the end of the day, both these are ways of getting around the
> > lack of multiple inheritance
> >
> 
> In this case, don't I have a completely different error object in
> $Core->db?
[Tim Ward]  Yes, which is exactly what you want.

the classes DB and Core both need to handle their own errors. What you don't
want to do is handle errors in DB within an instance of Core. That would
mean DB cannot cannot function except as part of Core. Remember  .. there
are 2 O's in OOP, the second one is important. Each class should be
complete. if you try to get DB to use error functions defined (or inherited
by) in Core you are effectively trying to get a parent to inherit from a
child.
>  
> adam

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to