LWN.net Logo

PHP 5.4.0 released

PHP 5.4.0 released

Posted Mar 3, 2012 0:49 UTC (Sat) by elanthis (guest, #6227)
In reply to: PHP 5.4.0 released by angdraug
Parent article: PHP 5.4.0 released

It's not true to say that the only exist in languages with single inheritance.

There's plenty of reason to have them even with multiple inheritance. Mixins can implement part of one or more interfaces, can include new members and methods, and -- this is most important -- can freely call into the class using the mixin.

In C++, which has no mixins, it is common to use a template to implement a mixin. Unfortunately it is not a "real" mixin due to various limitations the inheritance-based approach imposes. You can work around most of those with a lot of overly verbose syntax using CRTP, but it'd be nice if you didn't have to.


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds