note 101397 deleted from language.oop5.interfaces by danbrown
| From: | danbrown@php.net | Date: | Tue, 14 Dec 2010 22:14:11 +0000 |
| Subject: | note 101397 deleted from language.oop5.interfaces by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-174922@lists.php.net to get a copy of this message | ||
Note Submitter: rogier
----
at gratcypalma at gmail dot com:
The example you provided is NOT multiple inheritance. If this is what you understood of the concept,
I suggest you read a little more on the concept (e.g. through wikipedia).
Multiple inheritance indicates inheritance from more then one class at the same time, that is *at
declaration level*, and is NOT supported by PHP.
A multiple inheritance declaration for PHP *would* have a signature like e.g.
<?php
class C extends A,B {}
?>
The problems of implementing multiple inheritance are represented by the so-called 'Diamond
problem'. Since multiple inheritance is notoriously hard to implement in a language, many
languages do not support multiple inheritance. Besides that, the concept is often very confusing to
use or understand by novice programmers.
Luckily, though sometimes mistaken for multiple inheritance, it is possible to create sub-classes
through a certain hierarchy. Together with Interfaces (Subtype Polymorphism) this forms a pretty
solid base for basic OOP programming.
However, always keep in mind that the semantics of *true* multiple inheritance are really different
from those of single inheritance.