On Fri, Sep 25, 2015 at 11:53 PM, Stanislav Malyshev
<smalys...@gmail.com> wrote:
> Hi!
>
>> I'm thinking primarily of the benefit to base or abstract classes.  For
>
> Both can have constructors.
>
>> base classes which expect certain properties be set, they are exposed to
>> the danger of remaining unset if the derived class overrides the
>> constructor without calling the parent.
>
> You should always call the parent ctor. There's pretty much no reason to
> ever not to call parent ctor.
>
> --
> Stas Malyshev
> smalys...@gmail.com
>

Since there is no reason not to call parent ctor, maybe PHP should
somehow make every class have default empty ctor, if it doesn't have
one defined already - so you can write automatically
parent::__construct() everywhere?

Regards
Pavel Kouřil

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

Reply via email to