Re: extending a class

From: Date: Thu, 10 Apr 2003 18:44:20 +0000
Subject: Re: extending a class
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-143382@lists.php.net to get a copy of this message
What you want is: class base { var $var=0; } class new_class extends base { var $new_var = 1; } $base_class = new new_class; -Michael On Thu, 2003-04-10 at 10:41, Burhan Khalid wrote: > On Thu, 2003-04-10 at 13:24, Dennis Gearon wrote: > > Nope > > ------------------------------------------- > > ?php > > class 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 > > > > so what's wrong with using class new_class extends base ? > > -- > Burhan Khalid > phplist[at]meidomus[dot]com > > Please add a reply-to: header > in your messages that points > to the mailing list address > so that all mail is properly > archived and viewed.

« previous php.general (#143382) next »