Skip to content

Commit

Permalink
tp4 step 5 solution
Browse files Browse the repository at this point in the history
  • Loading branch information
ctruchi committed Feb 10, 2025
1 parent b01dabf commit 4443fec
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tp4/src/main/kotlin/fmt/kotlin/fundamentals/Container.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sealed class Container(
}
}

val equipments: List<String> = emptyList()
open val equipments: List<String> = emptyList()

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

class Barrel(
capacity: Int
) : Container(capacity, 20000..40000)
) : Container(capacity, 20000..40000) {
override val equipments = listOf("Robinet", "Bonde")
}

class Tank(
capacity: Int
capacity: Int,
override val equipments: List<String>
) : Container(capacity, 2000000..10000000)

sealed class FixedVolumeContainer(capacity: Int) : Container(capacity, capacity..capacity)
Expand Down

0 comments on commit 4443fec

Please sign in to comment.