We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b01dabf commit 4443fecCopy full SHA for 4443fec
1 file changed
tp4/src/main/kotlin/fmt/kotlin/fundamentals/Container.kt
@@ -10,7 +10,7 @@ sealed class Container(
10
}
11
12
13
- val equipments: List<String> = emptyList()
+ open val equipments: List<String> = emptyList()
14
15
fun containersNeededToPourIn(container: Container) = when (this) {
16
is Tank -> when (container) {
@@ -28,10 +28,13 @@ sealed class Container(
28
29
class Barrel(
30
capacity: Int
31
-) : Container(capacity, 20000..40000)
+) : Container(capacity, 20000..40000) {
32
+ override val equipments = listOf("Robinet", "Bonde")
33
+}
34
35
class Tank(
- capacity: Int
36
+ capacity: Int,
37
+ override val equipments: List<String>
38
) : Container(capacity, 2000000..10000000)
39
40
sealed class FixedVolumeContainer(capacity: Int) : Container(capacity, capacity..capacity)
0 commit comments