Re: OOP question regarding class extension
| From: | Matt McClanahan | Date: | Mon, 19 Mar 2001 19:48:15 +0000 |
| Subject: | Re: OOP question regarding class extension | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-44621@lists.php.net to get a copy of this message | ||
On Mon, Mar 19, 2001 at 01:58:39PM -0500, Altunergil, Oktay wrote:
> As far as I know a class can extend multiple classes. What you can't do -in
> PHP- is two create a class that inherits from multiple parent classes
> (multiple inheritence). I believe this is available in C++ and Java and
> others. I also think the reason it is not available in PHP is because
> inheriting from multiple classes tend to cause ambiguity when both of the
> parent classess have a function with the same definition etc.
>
> (I'm not an expert in this.. I'm just passing along what I have read).
Right. You can extend a chain of classes, but you can't have a
singular class extend from multiple classes directly.
That is, this works:
Apple extends Fruit
Fruit extends Food
This doesn't:
Apple extends Fruit and Produce
Matt
> -----Original Message-----
> From: John Guynn [mailto:John.Guynn@telescan.com]
> Sent: Monday, March 19, 2001 1:47 PM
> To: Php (E-mail)
> Subject: [PHP] OOP question regarding class extension
>
>
> Can one class extend multiple classes? I'm still playing with OOP
> functionality and maybe my logic is reversed but I think I need one class to
> extend many others.
>
> John Guynn
>
> This email brought to you by RFCs 821 and 1225.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net