jeudi 9 avril 2015

Is Mixin a special case of Policy-Based Design?

As far as i know, mixin is when you first write the derived class, and then you can inject the base class to it through a template parameter.


Example: http://ift.tt/1NdANNz


As i know Policy-based design is meant for the same. http://ift.tt/1fdFNuz


It doesn't say you should derive from it, you can use the template parameter other ways also. However, for example in wikipedia Policy-based design example is something like this:



template<typename Base>
class Derive: private Base


Which is i think the same as mixin. (instead, that in mixins you usually use public inheritence)


Is there any significant difference between them, or mixin is a special case of Policy-based design?


Aucun commentaire:

Enregistrer un commentaire