In Object-oriented programming (OOP) languages, a mixin is a class or module or interface that contains methods for use by the other classes without having to be the parent class of those other classes.
Mixins help avoid problem caused by multiple inheritance namely, Diamond Problem. Diamond problem is the reason why Java doesn’t support multiple inheritance.
Diamond Problem
Diamond problem is an ambiguity that arises when two classes: B & C inherit from A. And another class D, inherits from both class B and class C (multiple inheritance).
Now, if classes B & C both overrides a method in parent class A, and class D does not override it. Then which version of the method, would D inherit: class B’s version or class C’s version?