Mixin Interface?

C

cpisztest

What is it? First time I've seen that word appear in comments and I have a feeling the author isn't being truthful.

Looked it up on google and found a wikipedia entry, but it didn't really explain it well. It says that it is not done by inheritance...Ok, how is it done? A C++ example would help.
 
S

Stefan Ram

What is it?

A mixin is (according to me) a class that is intended to be
used as a superclass to provided a part of the features of
the subclass, possibly together with several other
superclasses (mixins) and possibly for several other
subclasses (clients). Code duplication in a set of classes
can be reduced by moving duplicated code into mixins and
then inheriting it from the mixins.

However, in C++, the term »mixin« sometimes specifically is
used to refer to a class template that has one template
parameter whose argument on instantiation will determine the
superclass of the template class. It then can add a certain
feature to this base, which then can be used by the client
of the mixin.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top