ここにいくつかのスニペットがあります:
コンストラクターメソッドのオーバーライドには、追加のパラメーターがあります。
class Cat { function __construct() {} } class Lion extends Cat { function __construct($param) {} }
(通常の)メソッドのオーバーライドには、追加のパラメーターがあります。
class Cat { function doSomething() {} } class Lion extends Cat { function doSomething($param) {} }
最初のものは機能し、2番目のものはスローしDeclaration of Lion::doSomething() should be compatible with that of Cat::doSomething()
ます。
なぜコンストラクタメソッドに対する特別な態度なのか?