Skip to content

Instantly share code, notes, and snippets.

@zapkub
Created July 29, 2021 02: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 zapkub/899e4d7dfa937cf972b35b48f8053567 to your computer and use it in GitHub Desktop.
Save zapkub/899e4d7dfa937cf972b35b48f8053567 to your computer and use it in GitHub Desktop.
class Class1 {
static Class1 instance = new Class1();
int i = 0;
}
class Class2 {
void set i(int val) {
Class1.instance.i = val;
}
int get i {
return Class1.instance.i;
}
}
void main() {
Class1 c1 = Class1.instance;
Class2 c2 = new Class2();
for (int i = 0; i < 5; i++) {
print('hello ${c1.i++}');
}
print('c2 value ${c2.i}');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment