Skip to content

Instantly share code, notes, and snippets.

@vadimtsushko
Created March 20, 2018 04:52
Show Gist options
  • Save vadimtsushko/1105a830606b0ab4f5c255714e989be6 to your computer and use it in GitHub Desktop.
Save vadimtsushko/1105a830606b0ab4f5c255714e989be6 to your computer and use it in GitHub Desktop.
abstract class Foo {
Function execute;
}
class Bar1 implements Foo {
Function execute = (String s) => print('Bar1 execute s: $s');
}
class Bar2 implements Foo {
Function execute = (int i) => print('Bar2 execute i: $i, i*2: ${i*2}');
}
void main() {
var bar1 = new Bar1();
bar1.execute('Hello');
bar1.execute(200);
var bar2 = new Bar2();
bar2.execute(4);
bar2.execute('Hello');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment