Created
October 12, 2024 05:08
-
-
Save gyugyu90/6ca0341dae561ecfac62dfc0dd47b881 to your computer and use it in GitHub Desktop.
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
class Tea { | |
String teaBag = "얼그레이"; | |
Milk? milk; | |
String getFullName() { | |
if (milk != null) { | |
return "$teaBag 밀크티"; | |
} | |
return "$teaBag 티"; | |
} | |
} | |
class Milk { | |
String name = "서울우유"; | |
int amount = 100; | |
} | |
void main() { | |
var tea = Tea(); | |
print(tea.getFullName()); // 얼그레이 티 | |
tea.teaBag = "캐모마일"; | |
tea.milk = Milk(); | |
print(tea.getFullName()); // 캐모마일 밀크티 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment