On Mon, Sep 19, 2011 at 2:27 AM, Stas Malyshev <smalys...@sugarcrm.com> wrote:
> Hi!
>
> On 9/18/11 5:24 PM, Pierre Joye wrote:
>>
>> class foo{
>>  function __construct(){}
>> }
>> class bar extends foo{
>>   function__construct($a, $b){}
>> }
>
> Come on. This is not my example. My example was:
>
> class foo{
>  function __construct($a, $b){}
> }
> class bar extends foo{
>  function__construct(){}
> }
>
> I would expect people at least read what I write before replying - is it too
> much?

You never misread something right? Can you please cool? Such comments
do not help, at all. Thanks.

> I wrote "foo() is compatible with foo($a, $b)" not the other way
> around and in case it wasn't clear I gave specific example.

But this exact example works, only the similar case using abstract
will fail, and it makes to fail here as an abstract method is only the
declaration, the implementation being done in the child class (bar
extends foo). This is the concept of 'abstract', see it like the
declaration and implementation in C. The PHP documentation is also
clear about that:

"Methods defined as abstract simply declare the method's signature"

For the record again here, the abstract example:
abstract class foo{
   abstract public function foo(Type1 $foo, Type2 $bar);
}

class bar extends foo{
  public function foo() {
  }
}


Cheers,
-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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

Reply via email to