note 61811 deleted from keyword.extends by danbrown

From: Date: Wed, 17 Jun 2009 19:03:01 +0000
Subject: note 61811 deleted from keyword.extends by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-157022@lists.php.net to get a copy of this message
Note Submitter: doedje ---- 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! =]

« previous php.notes (#157022) next »