[PHP] PHP OOP: Multiple Class Extends

2002-03-21 Thread Nathan Cassano


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




RE: [PHP] PHP OOP: Multiple Class Extends

2002-03-21 Thread Martin Towell

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:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 9:49 AM
To: [EMAIL PROTECTED]
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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php