Re: extending a class
| From: | Dennis Gearon | Date: | Thu, 10 Apr 2003 19:40:24 +0000 |
| Subject: | Re: extending a class | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143391@lists.php.net to get a copy of this message | ||
because in libraries like PHPLIB, the base library for session gets extended locally, then all the classes which then extend off of that extended class have to have their names changed. If a variable could be used, like:
$_PHPLIBOOPCFG = array(
's' => array( 'file'=>'session.inc' , 'class'=>'Session' ),
'u' => array( 'file'=>'user.inc', 'class'=>'User' ), 'a' => array( 'file'=>'auth.inc', 'class'=>'Auth' ), 'p' => array( 'file'=>'perm.inc', 'class'=>'Permission' )); Then all the classes would extend off of the correct, localized copy of a class, instead of editing mulitiple files, one would only edit one. Burhan Khalid wrote:
On Thu, 2003-04-10 at 13:24, Dennis Gearon wrote:Nope ------------------------------------------- ?php class base{so what's wrong with using class new_class extends base ?var $var=0;} $base_class = 'base'; class new_class extends $$base_class{var $new_var = 1;} gave error: - - - - - - - - Parse error: parse error, unexpected '$', expecting T_STRING in test_variable_base_class.php on line 6