note 101397 added to language.oop5.interfaces
| From: | rogier at osu1 dot php dot net | Date: | Tue, 14 Dec 2010 22:08:55 +0000 |
| Subject: | note 101397 added to language.oop5.interfaces | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174920@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 83.137.20.135
Probable Submitter: 62.45.206.112
----
Manual Page -- http://www.php.net/manual/en/language.oop5.interfaces.php
Edit -- https://master.php.net/note/edit/101397
Del: integrated -- https://master.php.net/note/delete/101397/integrated
Del: useless -- https://master.php.net/note/delete/101397/useless
Del: bad code -- https://master.php.net/note/delete/101397/bad+code
Del: spam -- https://master.php.net/note/delete/101397/spam
Del: non-english -- https://master.php.net/note/delete/101397/non-english
Del: in docs -- https://master.php.net/note/delete/101397/in+docs
Del: other reasons-- https://master.php.net/note/delete/101397
Reject -- https://master.php.net/note/reject/101397
Search -- https://master.php.net/manage/user-notes.php