Re: [PHP4BETA] class a extends $b?
| From: | John-Marc | Date: | Sun, 28 Nov 1999 20:29:32 +0000 |
| Subject: | Re: [PHP4BETA] class a extends $b? | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-7001@lists.php.net to get a copy of this message | ||
I don't have a compiler. Guess I'll enter it in as a bug. The file came
from zend.
-----Original Message-----
From: Andi Gutmans <andi@zend.com>
To: Dan Libby <danda@epinions.com>; php4beta@lists.php.net
<php4beta@lists.php.net>
Date: Sunday, November 28, 1999 1:03 PM
Subject: Re: [PHP4BETA] class a extends $b?
>You can't really do it although you could find all sorts of weird work
>arounds with eval() etc.
>Are you really sure you want to do this? It seems like pretty poor object
>oriented design. You could probably achieve the same goal in a much more
>structured way.
>Usually in OOD, in such a case you wouldn't inherit but have the class
>contained in your new class. It is more correct.
>
>Andi
>
>At 03:00 PM 11/27/99 -0800, Dan Libby wrote:
>>I'm using PHP4, beta 2. For cobranding purposes, I would like to have
>>classes inherit from other classes in a dynamic fashion. Ideally, it
>>would work like this:
>>
>>class a;
>>class b;
>>class c;
>>
>>$myclass = "a";
>>
>>class bar extends $myclass;
>>
>>class foo extends bar;
>>
>>Unfortunately, php tells me it is expecting a string in place of
>>$myclass. I then tried to do this:
>>
>>define("myclass", "a");
>>class bar extends myclass;
>>
>>That also failed, this time with no error message.
>>
>>So, question 1: Anyone know of a way to do this? I've thought of using
>>conditional includes, but that has its own set of problems.
>>Question 2: If not, is this in beta 3, or any chance of making it into
>>final release?
>>
>>thx.
>>
>>-dan
>>
>>
>>--
>>PHP 4.0 Beta Mailing List
>><http://www.php.net/version4/>
>>To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
>>For additional commands, e-mail: php4beta-help@lists.php.net
>>To contact the list administrators, e-mail: php4beta-admin@lists.php.net
>
>---
>Andi Gutmans <andi@zend.com>
>http://www.zend.com/
>
>--
>PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
>To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
>For additional commands, e-mail: php4beta-help@lists.php.net
>To contact the list administrators, e-mail: php4beta-admin@lists.php.net
>