note 80974 added to language.oop5.basic

From: Date: Fri, 08 Feb 2008 20:19:27 +0000
Subject: note 80974 added to language.oop5.basic
Groups: php.notes 
Request: Send a blank email to php-notes+get-135923@lists.php.net to get a copy of this message
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." ?> ---- Server IP: 209.41.74.194 Probable Submitter: 71.82.169.119 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.basic.php Edit -- https://master.php.net/note/edit/80974 Del: integrated -- https://master.php.net/note/delete/80974/integrated Del: useless -- https://master.php.net/note/delete/80974/useless Del: bad code -- https://master.php.net/note/delete/80974/bad+code Del: spam -- https://master.php.net/note/delete/80974/spam Del: non-english -- https://master.php.net/note/delete/80974/non-english Del: in docs -- https://master.php.net/note/delete/80974/in+docs Del: other reasons-- https://master.php.net/note/delete/80974 Reject -- https://master.php.net/note/reject/80974 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#135923) next »