Last active
October 12, 2024 03:45
-
-
Save gyugyu90/c887b8d5a0e197172a16615cf8f4a8f3 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 Syrup { | |
String name; | |
int amount; | |
Syrup(this.name, this.amount); | |
} | |
class Coffee { | |
String beanType; | |
int waterAmount; | |
bool hot; | |
Syrup? syrup; | |
Coffee(this.beanType, | |
[this.waterAmount = 40, this.hot = true, this.syrup]); // optional | |
bool isEspresso() { | |
return waterAmount <= 50; | |
} | |
} | |
void main(List<String> args) { | |
var coffee1 = Coffee('에티오피아 예가체프', 350, false, Syrup("바닐라", 5)); | |
var coffee2 = Coffee('콜롬비아 수프리모'); | |
print(coffee2.waterAmount); // 40 | |
print(coffee2.hot); // true | |
var coffee3 = Coffee('브라질 산토스', 200); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment