Is Mixin a special case of Policy-Based Design?

733 views Asked by At

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://www.drdobbs.com/cpp/mixin-based-programming-in-c/184404445

As I know Policy-based design is meant for the same. http://en.wikipedia.org/wiki/Policy-based_design

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?

0

There are 0 answers