Skip to content

Instantly share code, notes, and snippets.

@t-cool
Created November 8, 2021 03:14
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 t-cool/359ff405c5ea5425a05a7c2dda5a1620 to your computer and use it in GitHub Desktop.
Save t-cool/359ff405c5ea5425a05a7c2dda5a1620 to your computer and use it in GitHub Desktop.
Dart Mixin
// クラスの継承関係でうまくいかないとき Mixin で継承をする
mixin M {
int intM = 111;
String methodM() => "M's method";
}
mixin N {
int intN = 111;
String methodN() => "N's method";
}
class MixedinClass with M,N{
}
main(){
var obj = MixedinClass();
print(obj.intM);
print(obj.methodN());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment