Skip to content

Instantly share code, notes, and snippets.

@rafaldziuryk
Created October 15, 2019 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaldziuryk/ecd3e022d1df2954e469f1bdeee95191 to your computer and use it in GitHub Desktop.
Save rafaldziuryk/ecd3e022d1df2954e469f1bdeee95191 to your computer and use it in GitHub Desktop.
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