Re: [PHP-LANG] OO-problem

[email protected] (Rasmus Lerdorf)
Newsgroups php.lang
Message-ID <[email protected]>
PHP does not support method overloading like that.

-Rasmus

On Tue, 17 Apr 2001, Bas Cancrinus wrote:

> Hi,
>
> I'm experiencing the following problem when I try to implement an
> OO-model in PHP:
> If a class, say A, has more than 1 method with equal names, say b, and
> different signatures and one of these methods b of an instance A is
> called, then PHP always delegates that call to the first method that
> appears in the code.
> Example:
>
> class A {
>    function b () {
>        ...
>    }
>    function b ($var) {
>        ...
>    }
> }
> $anInstance = new A;
> $aReturnValue = $anInstance->b (...) // Won't work
>
> Is this a bug or is there any other reason for this behaviour?
>
> Thanks,
> Bas
>
>
> --
> PHP Language Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> To contact the list administrators, e-mail: [email protected]
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.