Created with <3 with dartpad.dev.
Created
August 27, 2023 19:24
-
-
Save catalunha/6497b517746c0df0bc3dc670a7dbdcd6 to your computer and use it in GitHub Desktop.
Heranca e Switch
This file contains hidden or 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
void main() { | |
final String a = 'a'; | |
final String b; | |
b = a; | |
print(b); | |
final C c = D('d'); | |
final String f; | |
switch (c) { | |
case D(c: final dd): | |
f = dd; | |
case E(c: final ee): | |
f = ee; | |
} | |
print(f); | |
} | |
sealed class C { | |
final String c; | |
C(this.c); | |
} | |
class D extends C { | |
// final String d; | |
D(super.d); | |
} | |
class E extends C { | |
// final String e; | |
E(super.e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment