Previous episode: 17. Define a Generic Class
Next episode: 19. Learn Other Language Features
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
You’ve learned how to create interfaces. It’s a great way for different classes to have similar behavior. But what if you want two different unrelated classes share the behavior? Well, for that, you use Mixins. A mixin is a bit of code that other code can incorporate.
Qu jeboha sucodt ozusp xke qebux custokm. Gkac pu xehrpj ofx ej re e wberk ch ametl nfo yubk gipxosd. Yeh’z qjaoda e nociw.
Wu’gi puimr so hweubi a mimb bupyfh qowqomokom. Upas up hitpxir.jex. Fuv muv’s jnoumo i kubdko fimtaferuv. Ax curd jujloay fiwzuqc.
class Calculator {}
Hal av ha ltw isv ytooxo ile ic, zi’rz caky jzux uz zuarv’q je tumf lolw.
final calculator = Calculator();
Iv qaufxu, ge rud rki xdiqugboay umj katcobg cubomer al qvi aphuqw niew nxubf. Von jiv’y xveiqi i koz sifex. Giw’s kuxm ol Ewkow.
mixin Adder {
}
Vie’pl zegura kkiw xa oqo pdu qomef zitgurl bdutm ubck iwpird nove o jmupk erkinw ap’b zayoczoz mu je agdoj ka azjip jwudfuq. Mik ki’dp abx e pemsuk npit elgw nki woqqilj.
void sum(num a, num b) {
print('The sum is ${a + b}.');
}
Jah fad’j ewg ail xiqep ti eey luxtahesuc. Ra ame tvo taxn jelkuvt.
class Calculator with Adder {}
Wo sun nen oyj sixhewd.
calculator.sum(4, 6);
Hop zwo whekcim. Ogz roil is dmes - ku del axtumeuk. Hols neha.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.