Created
October 15, 2019 13:28
-
-
Save rafaldziuryk/ecd3e022d1df2954e469f1bdeee95191 to your computer and use it in GitHub Desktop.
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
abstract class Animal implements Run { | |
void go() { | |
print("I'm Animal"); | |
} | |
} | |
abstract class Bird extends Animal { | |
void go() { | |
super.go(); | |
print("I'm Bird"); | |
} | |
} | |
abstract class Run { | |
void go(); | |
} | |
mixin Walker on Run { | |
void go() { | |
super.go(); | |
print("I'm walking"); | |
} | |
} | |
mixin Swimmer on Run { | |
// This class is intended to be used as a mixin, and should not be | |
// extended directly. | |
void go() { | |
super.go(); | |
print("I'm swimming"); | |
} | |
} | |
mixin Flyer on Run { | |
// This class is intended to be used as a mixin, and should not be | |
// extended directly. | |
void go() { | |
super.go(); | |
print("I'm flying"); | |
} | |
} | |
class Duck extends Bird with Walker, Swimmer, Flyer {} | |
void main() { | |
Duck().go(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment