On Fri, 21 Jul 2006, Soenke Ruempler wrote:

> Derick Rethans <mailto:[EMAIL PROTECTED]> wrote on Friday, July 21, 2006
> 11:31 AM:
> 
> > It's quite a different thing in C++ as there you have method
> > overloading which PHP doesn't have. Therefore your argument doesn't
> 
> Exactly the point. It's parameter polymorphism in C++/Java.
> 
> > hold here as they are simply *two different* methods, and not an
> > overriden one. In your code that uses the derived class you can still
> > use both methods (one without, and the one with parameters).
> 
> To be compatible, the only thing you have to do is adding standard
> values to derived methods' parameters:
> 
> $ php -d"error_reporting=8191" -r 'class c{function f(){}} class d
> extends c{function f($a){}}';
> 
> Strict Standards: Declaration of d::f() should be compatible with that
> of c::f() in Command line code on line 2
> 
> $ php -d"error_reporting=8191" -r 'class c{function f(){}} class d
> extends c{function f($a = null){}}';
> $ [no error]
> 
> This behaviour makes sense to me.

Yes... and this is how C++ does it.

Derick

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to