|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-02-03 22:11 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Feb 12 11:00:01 2026 UTC |
Description: ------------ Class inheritence isn't consistent. The attach code basically explains it all. Why would it choose to use the child class in the first case, but the parent class in the second? This seems wrong to me, like it's deciding when to use one over the other which makes for a confusing programming environment. Reproduce code: --------------- <?PHP class blah { public $test = "A"; public function __construct(){ echo($this->test); } } class tacos extends blah { public $test = "B"; } $tacos = new tacos(); //Output: B //Expected output: B class P { public function __construct() { $this->fun(); } private function fun() { echo 'funny'; } } class C extends P { public function fun(){ echo "oranges"; } }; $var = new C(); //Output: funny //Expected output: oranges ?> Expected result: ---------------- Boranges Actual result: -------------- Bfunny