# problem with interfaces

- Thread: https://externals.io/message/4321
- Original archive: https://news-web.php.net/php.internals/4321
- Started by Cristiano Duarte on 2003-08-31T15:56:10+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #4321 — Cristiano Duarte — 2003-08-31T15:56:10+00:00

URL: https://externals.io/message/4321#4321

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

---

## #4438 — Cristiano Duarte — 2003-09-08T23:51:33+00:00

URL: https://externals.io/message/4321#4438 · In reply to: #4321

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
> preserved.
>
> Cristiano Duarte
