Skip to content

Commit 597709d

Browse files
ctruchiCLOVIS-AI
authored andcommitted
tp5 step 3 solution
1 parent 0e07329 commit 597709d

File tree

1 file changed

+7
-3
lines changed
  • tp5/src/main/kotlin/fmt/kotlin/fundamentals

1 file changed

+7
-3
lines changed

tp5/src/main/kotlin/fmt/kotlin/fundamentals/Bottle.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@ data class Bottle(
66
val color: WineColor
77
) {
88

9+
val mainSales = color.mainSales
10+
911
fun isEqualTo(bottle: Bottle) = this == bottle
1012

1113
fun isSameInstance(bottle: Bottle) = this === bottle
1214

1315
override fun toString() = "Bouteille de $name ${color.translate()} de $year"
1416
}
1517

16-
enum class WineColor {
17-
RED,
18-
WHITE;
18+
enum class WineColor(
19+
val mainSales: Boolean
20+
) {
21+
RED(true),
22+
WHITE(false);
1923

2024
fun translate() = when (this) {
2125
RED -> "rouge"

0 commit comments

Comments
 (0)