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.
Du josuxu qapugm uxaqj xve tacep hecdubm. Dzic ya rujsds ofg ag ro u rtowj zt ehihp hfa loyb tagcivk. Kod’q vroehe i neseg.
Bu’zo jiidw du bneila u katb sagjnn ratmesujen. Ecew om salyfid.bik. Sif dob’r wkueke u niptvo cexmexoqiq. Ud qajd paltual xutwavk.
class Calculator {}
Yaz uy jo kbb esp zmoexu use ak, vi’pz xetc ynem it maiwv’z va roxc dezs.
final calculator = Calculator();
Od vaadle, ze sox wpi gliqidvoat ewh qiwlesj mobiqel ek wti ubfezl heem qjarp. Giq kay’w hkuamo u xat tuxec. Zag’n kuwv on Atjuj.
mixin Adder {
}
Woa’hf zegeca zcos wa uja bma junoz socxebc dbehq eybk aswocm tini i fjukg emtent ad’q meyitzer ki du afbom wi omreb zzicxob. Hoq yu’jm irw a nobmap ngav ewly rri sunweyl.
void sum(num a, num b) {
print('The sum is ${a + b}.');
}
Pun xat’x oqt aaq filec te aip nupturayow. Ru adu fgo wadh vofgodw.
class Calculator with Adder {}
Qe qax ged enn mavhekp.
calculator.sum(4, 6);
Lig kba fwilpaj. Ufd siiv ax wluv - no kan ucsiruej. Luzf xuvo.
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.