NYCPHP Meetup

[nycphp-talk] OOP Newbie Building arrays in extended classes

Anthony Ferrara ircmaxell at gmail.com
Tue Jan 29 09:43:46 EST 2013


The constructor's return value is always ignored internally. So the only
time the constructor's return is ever used is in a child-class.

if (parent::__construct()) {
    // blah
}

But I'd argue that if you need to do that, inheritance isn't what you need,
but another form of composition...

Anthony


On Tue, Jan 29, 2013 at 9:34 AM, David Mintz <david at davidmintz.org> wrote:

> This might be little more than a matter of style, but I would add that I
> don't think Person's  __construct() should return a boolean. By definition
> it returns an instance of the Person class, so you need not explicitly
> return anything.
>
>
> --
> David Mintz
> http://davidmintz.org/
> Fight for social equality:
> http://socialequality.com/
>
>
> _______________________________________________
> New York PHP User Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/show-participation
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20130129/7e00b4eb/attachment.html>


More information about the talk mailing list