File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
tp4/src/main/kotlin/fmt/kotlin/fundamentals Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ sealed class Container(
10
10
}
11
11
}
12
12
13
- val equipments: List <String > = emptyList()
13
+ open val equipments: List <String > = emptyList()
14
14
15
15
fun containersNeededToPourIn (container : Container ) = when (this ) {
16
16
is Tank -> when (container) {
@@ -28,10 +28,13 @@ sealed class Container(
28
28
29
29
class Barrel (
30
30
capacity : Int
31
- ) : Container(capacity, 20000 ..40000 )
31
+ ) : Container(capacity, 20000 ..40000 ) {
32
+ override val equipments = listOf (" Robinet" , " Bonde" )
33
+ }
32
34
33
35
class Tank (
34
- capacity : Int
36
+ capacity : Int ,
37
+ override val equipments : List <String >
35
38
) : Container(capacity, 2000000 ..10000000 )
36
39
37
40
sealed class FixedVolumeContainer (capacity : Int ) : Container(capacity, capacity..capacity)
You can’t perform that action at this time.
0 commit comments