note 61811 added to keyword.extends

From: Date: Sun, 12 Feb 2006 21:37:21 +0000
Subject: note 61811 added to keyword.extends
Groups: php.notes 
Request: Send a blank email to php-notes+get-103582@lists.php.net to get a copy of this message
tilman's note is not quite true. He states the fact that php gives wrong information about the parent class. But this is not the case. Php does give correct information about the parent class, to prove that I give the following code: <?php class a { function showInfo() { print "I am class " . get_class($this) . ", my parent is " .get_parent_class($this); } } class b extends a {} class c extends b {} $myInstanceB = new b(); $myInstanceB->showInfo(); print "<br />"; $myInstanceC = new c(); $myInstanceC->showInfo(); /* output: I am class b, my parent is a I am class c, my parent is b */ ?> The thing is the function showInfo as they were called by my script, are not a member of class a, but are a member of class b and c. They respond accordingly. Showing correct output in the case of get_class and get_parent_class. So don't go blaming php! =] ---- Server IP: 194.109.193.119 Probable Submitter: 194.109.231.13 ---- Manual Page -- http://www.php.net/manual/en/keyword.extends.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61811 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61811&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61811&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61811&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61811&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61811&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61811&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61811&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61811&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#103582) next »