problem with interfaces

php.internals

Cristiano Duarte

23 years ago
Hi all, Is this supposed to work? interface test { function my_function ($mandatory_parameter); } class test_class implements test { function my_function ($mandatory_parameter, $optional_parameter = null) { } } The test_class class implements correctly the 'test' interface since PHP does not allow multiple explicit method declarations (explicit overloading). IMHO, if all additional parameters are optional, the interface commitment is preserved. Cristiano Duarte

Cristiano Duarte

22 years ago
Did anyone think about it ? Any opinions ? Cristiano Duarte. "Cristiano Duarte" <cunha17@uol.com.br> escreveu na mensagem news:20030831155609.91744.qmail@pb1.pair.com...
> Hi all, > > Is this supposed to work? > > interface test { > function my_function ($mandatory_parameter); > } > > class test_class implements test { > function my_function ($mandatory_parameter, $optional_parameter =
null)
> { > } > } > > The test_class class implements correctly the 'test' interface since PHP > does not allow multiple explicit method declarations (explicit
overloading).
> > IMHO, if all additional parameters are optional, the interface commitment
is