Skip to content

Instantly share code, notes, and snippets.

@gyugyu90
Created October 12, 2024 03:30
Show Gist options
  • Save gyugyu90/3e1d5e738a41705d774d542cd0818024 to your computer and use it in GitHub Desktop.
Save gyugyu90/3e1d5e738a41705d774d542cd0818024 to your computer and use it in GitHub Desktop.
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, this.hot, [this.syrup]); // optional
bool isEspresso() {
return waterAmount <= 50;
}
}
void main(List<String> args) {
var coffee1 = Coffee('에티오피아 예가체프', 350, false, Syrup("바닐라", 5));
var coffee2 = Coffee('콜롬비아 수프리모', 40, true);
var coffee3 = Coffee('브라질 산토스', 200, true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment