首先聲明,這是一個STRICT錯誤,如果你不在error_reporting里把它打開,一般是看不到的,以下是我的代碼<?phpclass A{ private function test($a, $b, $c) { echo 'test';
}
}class B extends A{ private function test($d) { echo 'hello';
}
}new B();它會報錯Strict Standards: Declaration of B::test() should be compatible with that of A::test() in /home/work/test.php on line 17如果是public函數重載還能說的過去,而我只是在私有函數中使用了同名的方法,但是對于子類來說這并不算是重載吧,為什么這樣還會報警告呢?
- 1 回答
- 0 關注
- 106 瀏覽
添加回答
舉報
0/150
提交
取消