RE: PHP object communication
| From: | ad at m dot beecher dot net | Date: | Thu, 25 Oct 2001 10:55:43 +0000 |
| Subject: | RE: PHP object communication | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-72246@lists.php.net to get a copy of this message | ||
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:
> 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?
adam