Class and extends pb/bug? with php404pl1
| From: | Hugues BRUNEL | Date: | Tue, 22 May 2001 09:54:51 +0000 |
| Subject: | Class and extends pb/bug? with php404pl1 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-53830@lists.php.net to get a copy of this message | ||
I use PHP 4.0.4pl1 and I don't understand why this doesn't work.
Does somebody help me ?
class a {
var $foo1 ;
function a($thefoo) {
$this->$foo1 = $thefoo ;
echo "a::foo1=".$this->$foo1."\n" ;
}
}
class b extends a {
var $foo2 ;
function b($thefoo1, $thefoo2) {
$this->a($thefoo1) ;
$this->$foo2 = $thefoo2 ;
echo "b::foo1=".$this->$foo1."\n" ;
echo "b::foo2=".$this->$foo2."\n" ;
}
}
$toto = new b(1,3) ;
echo "FOO1=".$toto->$foo1."\n" ;
echo "FOO2=".$toto->$foo2."\n" ;
The result is:
a::foo1=1
b::foo1=3 <- (and not 1) ???
b::foo2=3
FOO1=3 <- (and not 1) ???
FOO2=3
Many thanks for any information (perhaps I'm very tired and I understand nothing??)
Hugues.
--
Synaptique Europe
www.synaptique.com