Re: Extending classes multiple times
| From: | Rasmus Lerdorf | Date: | Thu, 06 Dec 2001 19:51:33 +0000 |
| Subject: | Re: Extending classes multiple times | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-76932@lists.php.net to get a copy of this message | ||
> I had been under the impression that one could extend a class only once.
> That is, if I extend class A with class B I would then not be able to
> extend B again with any other class.
>
> See: http://www.php.net/manual/en/keyword.extends.php
> "An extended class is always dependent on a single base class, that is,
> multiple inheritance is not supported. Classes are extended using the
> keyword 'extends'."
>
> With some testing however, it appears that I can extend class B with
> class C and class C with class D and so on...
>
> Am I misinterpreting the manual? I suspect I am. Or is this a new
> feature. Thoughts?
This is not a new feature. In your example each class only has a single
parent. Multiple Inheritance is when you do something like:
class C extends A,B { ... }
Doing B extends A followed by C extends B is still single inheritance.
-Rasmus