Created with <3 with dartpad.dev.
Created
January 5, 2023 14:03
-
-
Save faizan1947/2e45da68fd56038f5560466e16a5f1fd to your computer and use it in GitHub Desktop.
dart-mixin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
Duck().fly(); | |
Duck().swim(); | |
Duck().move(); | |
} | |
class Animal{ | |
void move(){ | |
print('moving position'); | |
} | |
} | |
mixin canSwim{ | |
void swim(){ | |
print('changing position by swimming'); | |
} | |
} | |
mixin canFly{ | |
void fly(){ | |
print('changing position by Flying'); | |
} | |
} | |
class Duck extends Animal with canSwim,canFly{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment