RE: [PHP] PHP OOP: Multiple Class Extends
| From: | Martin Towell | Date: | Thu, 21 Mar 2002 23:07:02 +0000 |
| Subject: | RE: [PHP] PHP OOP: Multiple Class Extends | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-89605@lists.php.net to get a copy of this message | ||
Extending more that once, as you did in your example, is perfectly okay.
It's just when you try to do it in one go. ie. you can't do multi-extends,
but you can extend more than once (if you get what I mean)
HTH
Martin
-----Original Message-----
From: Nathan Cassano [mailto:nathan@cjhunter.com]
Sent: Friday, March 22, 2002 9:49 AM
To: php-general@lists.php.net
Subject: [PHP] PHP OOP: Multiple Class Extends
Attention PHP guru's,
I have a question about PHP and OOP. My problem is that I want
multiple inheritance functionality in PHP but it does not support this
(see http://www.zend.com/manual/keyword.extends.php).
My question is can
PHP classes be extended multiple times to simulate multiple inheritance?
Is this supported? Is this safe?
It do seems to work.
<?
class A {
var $A = "A";
}
class B extends A {
var $B = "B";
}
class C extends B {
var $C = "C";
}
$test = new C();
var_dump($test);
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php