extended class question

From: Date: Mon, 13 Sep 2004 21:03:50 +0000
Subject: extended class question
Groups: php.general 
Request: Send a blank email to php-general+get-196571@lists.php.net to get a copy of this message
How come the output to this script is "World Trade Center" instead of "Pizza Delivery"? Thanks, Ed ---------------------------------------------------------------- <?php class test { private $var1; function __construct() { $this->var1 = "World Trade Center"; } function get_var1() { return $this->var1; } function set_var1($data) { $this->var1 = $data; } } class testing extends test { function __construct() { parent::__construct(); $this->var1 = "Pizza Delivery"; } } $test2 = new testing(); print "var1 = " . $test2->get_var1() . "<br>"; ?>

« previous php.general (#196571) next »