note 119369 added to language.oop5.basic

From: Date: Mon, 23 May 2016 07:26:55 +0000
Subject: note 119369 added to language.oop5.basic
Groups: php.notes 
Request: Send a blank email to php-notes+get-205536@lists.php.net to get a copy of this message
i try to use class B to extends A to get the results,whta i know result is jim,b,but the result layout is b,jim,b.when i change the class name or function name to another like Class C or function c(),the result is jim,b,i don't know why. class A{ public $name = "jim"; public function a(){ echo "b"; } } class B extends A{ } $b = new B; echo $b->name; //bjim echo "\n"; $b->a(); //b after change: class AA{ public $name = "jim"; public function a(){ echo "b"; } } class B extends AA{ } $b = new B; echo $b->name; //jim echo "\n"; $b->a(); //b ---- Server IP: 72.52.91.14 Probable Submitter: 114.242.6.74 ---- Manual Page -- http://php.net/manual/en/language.oop5.basic.php Edit -- https://master.php.net/note/edit/119369 Del: integrated -- https://master.php.net/note/delete/119369/integrated Del: useless -- https://master.php.net/note/delete/119369/useless Del: bad code -- https://master.php.net/note/delete/119369/bad+code Del: spam -- https://master.php.net/note/delete/119369/spam Del: non-english -- https://master.php.net/note/delete/119369/non-english Del: in docs -- https://master.php.net/note/delete/119369/in+docs Del: other reasons-- https://master.php.net/note/delete/119369 Reject -- https://master.php.net/note/reject/119369 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#205536) next »