Hello Timm,

well for normal methods we must do that. The derived class must support the
same signature that the base class supports. In you example that would only
work if the derived method would have a default parameter for the additional
parameter:

<?php
  class Foo {
    function connect($server) {
    }
  }
  
  class Bar extends Foo {
    function connect($server, $port = NULL) {
    }
  }
?>

regards
marcus


Wednesday, February 25, 2004, 11:52:20 PM, you wrote:

> On Wed, 2004-02-25 at 23:44, Marcus Boerger wrote:
>> Hello Timm,
>> 
>> i had the same expirience today too. And also for me it makes not much
>> sense. The constructor shouldn't check inheritance rules.

> Neither should other methods follow this. What if I want to add a
> non-default parameter to an overriden method?

> <?php
>   class Foo {
>     function connect($server) {
>     }
>   }
  
>   class Bar extends Foo {
>     function connect($server, $port) {
>     }
>   }
?>>

> I see where the problem comes from:

> zend_do_perform_implementation_check() is called from
> do_inherit_method_check() (both in zend_compile.c) which in turn is
> called for inheritance *and* for interfaces. The behaviour is fully
> desirable when implementing interfaces but not for regular inheritance.

> - Timm




-- 
Best regards,
 Marcus                            mailto:[EMAIL PROTECTED]

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

Reply via email to