== Quote from Hans Lellelid ([EMAIL PROTECTED])'s article > In more traditional PHP this works fine: > > class A { > function init() { ... } > function doSomething($arg1, $arg2) { ... } > } > > class B extends A { > function doSomething($arg1, $arg2, $arg3, $arg4 = null) { ... } > function doSomethingElse($arg1) { ... } > }
Even if PHP allows it, there is however a problem. Imagine you write code that assumes to have a A object. So you call doSomething() with only 2 arguments. If you now pass to this code a B object, you will have an error because $arg3 is not provided. So adding arguments to an overloaded method should only be done if the additionnal arguments have a default value. Stephane -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php