note 97333 added to language.oop5.inheritance
| From: | jackdracona at msn dot com | Date: | Thu, 15 Apr 2010 03:53:15 +0000 |
| Subject: | note 97333 added to language.oop5.inheritance | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168248@lists.php.net to get a copy of this message | ||
Here is some clarification about PHP inheritance â there is a lot of bad information on the
net. PHP does support Multi-level inheritance. (I tested it using version 5.2.9). It does not
support multiple inheritance.
This means that you cannot have one class extend 2 other classes (see the extends keyword).
However, you can have one class extend another, which extends another, and so on.
Example:
<?php
class A {
// more code here
}
class B extends A {
// more code here
}
class C extends B {
// more code here
}
$someObj = new A(); // no problems
$someOtherObj = new B(); // no problems
$lastObj = new C(); // still no problems
?>
----
Server IP: 64.71.164.2
Probable Submitter: 70.190.10.61
----
Manual Page -- http://www.php.net/manual/en/language.oop5.inheritance.php
Edit -- https://master.php.net/note/edit/97333
Del: integrated -- https://master.php.net/note/delete/97333/integrated
Del: useless -- https://master.php.net/note/delete/97333/useless
Del: bad code -- https://master.php.net/note/delete/97333/bad+code
Del: spam -- https://master.php.net/note/delete/97333/spam
Del: non-english -- https://master.php.net/note/delete/97333/non-english
Del: in docs -- https://master.php.net/note/delete/97333/in+docs
Del: other reasons-- https://master.php.net/note/delete/97333
Reject -- https://master.php.net/note/reject/97333
Search -- https://master.php.net/manage/user-notes.php