What is Mixin Based Inheritance in Dart?

Issue

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

Answered By – Günter Zöchbauer

Answer Checked By – Mary Flores (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *