Hi!

On 9/18/11 5:42 PM, Pierre Joye wrote:
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

It produces E_STRICT for regular functions, but for some reason not for ctors, but fatal error for abstract ctors. Quite weird.

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

No, it's not at all like declaration and implementation in C. In C, declaration and implementation relate to the SAME entity. In PHP, abstract method and its (multiple, inependent) implementations are different entities. Moreover, this is prohibited too:

abstract class BaseClass {
    abstract public function foo(Type1 $foo, Type2 $bar);
}

class ExtendedClass extends BaseClass {
   public function foo(Type1 $foo, Type2 $bar) {}
}

class MoreExtendedClass extends ExtendedClass {
   public function foo() { }
}

even though it is clear that ExtendedClass::foo() and MoreExtendedClass::foo() are two different concrete functions, so your "abstract is declaration only" argument does not work either.

This makes absolutely no sense, as there's no reason why MoreExtendedClass can't extend domain of ExtendedClass. However, for some reason it is prohibited.

The example without abstract works, but produces E_STRICT which is useless too.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

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

Reply via email to