Skip to content

Commit 4443fec

Browse files
committed
tp4 step 5 solution
1 parent b01dabf commit 4443fec

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tp4/src/main/kotlin/fmt/kotlin/fundamentals/Container.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ sealed class Container(
1010
}
1111
}
1212

13-
val equipments: List<String> = emptyList()
13+
open val equipments: List<String> = emptyList()
1414

1515
fun containersNeededToPourIn(container: Container) = when (this) {
1616
is Tank -> when (container) {
@@ -28,10 +28,13 @@ sealed class Container(
2828

2929
class Barrel(
3030
capacity: Int
31-
) : Container(capacity, 20000..40000)
31+
) : Container(capacity, 20000..40000) {
32+
override val equipments = listOf("Robinet", "Bonde")
33+
}
3234

3335
class Tank(
34-
capacity: Int
36+
capacity: Int,
37+
override val equipments: List<String>
3538
) : Container(capacity, 2000000..10000000)
3639

3740
sealed class FixedVolumeContainer(capacity: Int) : Container(capacity, capacity..capacity)

0 commit comments

Comments
 (0)