note 95580 added to keyword.extends

From: Date: Sun, 10 Jan 2010 17:46:15 +0000
Subject: note 95580 added to keyword.extends
Groups: php.notes 
Request: Send a blank email to php-notes+get-164833@lists.php.net to get a copy of this message
Just a quick example of how PHP will handle a parent calling a function named in both the parent and the child class. You would think it might use the function the way it is defined in the parent, but it does use the function that is defined in the child. <?php class One{ function showOne(){ echo 'Function One prints'; } function hitFunction(){ $this->showOne(); } } class Two extends One{ function showOne(){ echo 'Function Two prints'; } } $thistwo = new Two; $thistwo->hitFunction(); //prints "Function Two prints" ?> ---- Server IP: 69.147.83.197 Probable Submitter: 24.91.74.182 ---- Manual Page -- http://www.php.net/manual/en/keyword.extends.php Edit -- https://master.php.net/note/edit/95580 Del: integrated -- https://master.php.net/note/delete/95580/integrated Del: useless -- https://master.php.net/note/delete/95580/useless Del: bad code -- https://master.php.net/note/delete/95580/bad+code Del: spam -- https://master.php.net/note/delete/95580/spam Del: non-english -- https://master.php.net/note/delete/95580/non-english Del: in docs -- https://master.php.net/note/delete/95580/in+docs Del: other reasons-- https://master.php.net/note/delete/95580 Reject -- https://master.php.net/note/reject/95580 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164833) next »