note 80974 deleted from language.oop5.basic by felipe

From: Date: Mon, 24 Mar 2008 22:14:01 +0000
Subject: note 80974 deleted from language.oop5.basic by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-137478@lists.php.net to get a copy of this message
Note Submitter: Amaroq ---- To simplify upon SID TRIVEDI's example: <?php class foo { public $a = 'This is class foo.'; public function display_var() { echo $this->a; } } class bar extends foo { public $a = 'This is class bar.'; public function display_parent() { parent::display_var(); // Call directly from foo. Still runs in the scope of bar. } } $parent = new foo(); $child = new bar(); $parent->display_var(); //Outputs "This is class foo." $child->display_var(); //Outputs "This is class bar." $child->display_parent(); //Outputs "This is class bar." ?>

« previous php.notes (#137478) next »