3 ms·
> It's super common Curiously recurring, even! [0] Although what you're showing seems to be a variation on the curiously recurring template pattern, as the cl
by MaxBarraclough 6y ago
> It's super common
Curiously recurring, even! [0]
Although what you're showing seems to be a variation on the curiously recurring template pattern, as the classes being mixed are listed 'symmetrically' without much regard for which will inherit from which. I found a blog post on 'mixin classes', which are like the CRTP but invert the inheritance relation. [1] What you've shown seems to be a third way.
[0] https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern https://en.wikipedia.org/wiki/Curiously_recurring_template_p...
[1] https://www.fluentcpp.com/2017/12/12/mixin-classes-yang-crtp/ https://www.fluentcpp.com/2017/12/12/mixin-classes-yang-crtp...
- jcelerier 6y agoyes, it's not proper CRTP but I did not want to spend too much time on that... just show that multiple inheritance has its uses even in fairly generic, non-OOP code :-)