|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-02-18 12:22 UTC] edwardpro dot zhu at gmail dot com
Description:
------------
when extends father class,which declared one contruction function with params, then you extend this class and declare one another contruction function in it(not same the params list as his father class). Run it, you will find something unexcepted output. You can check the code belowed.
Reproduce code:
---------------
abstract class father{
function father($a){
echo "class father";
}
}
class child extends father{
function child(){
echo "test";
}
}
//run
$obj = new child('a');
Expected result:
----------------
no error,no output.
Actual result:
--------------
return wrong message: can't redeclare contraction function!
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sat Mar 14 08:00:01 2026 UTC |
i just try php 5.2.6 the result, i get, is the same as the 5.2.5. look my instance order: new child('a'); it's not "function child()", but php run this construction function,that's may accour something unexcepted result.