Search code examples
inheritancedartdart-pub

What is Mixin Based Inheritance in Dart?


This is definition of Mixin Based Programming from the official Docs,

Mixin-based inheritance means that although every class (except for Object) has exactly one superclass, a class body can be reused in multiple class hierarchies.

Can anyone explain this ?


Solution

  • Mixins are a limited way to reduce the limitations of single-inheritance (in contrary to for example C++ which allows multiple inheritance)

    Mixins allow to inherit implementations of methods from one superclass and one or more mixin classes.

    See also