File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed 
tp4/src/main/kotlin/fmt/kotlin/fundamentals Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ sealed class Container(
66) {
77    val  valid =  (possibleCapacities).contains(capacity)
88
9-     val  equipments:  List <String > =  emptyList()
9+     open   val  equipments:  List <String > =  emptyList()
1010
1111    open  fun  containersNeededToPourIn (container :  Container ) =  capacity /  container.capacity
1212}
@@ -15,14 +15,17 @@ class Barrel(
1515    capacity :  Int 
1616) : Container(capacity, 20000 ..40000 ) {
1717
18+     override  val  equipments =  listOf (" Robinet"  , " Bonde"  )
19+ 
1820    override  fun  containersNeededToPourIn (container :  Container ) =  when  (container) {
1921        is  Barrel , is  Tank  ->  - 1 
2022        else  ->  super .containersNeededToPourIn(container)
2123    }
2224}
2325
2426class  Tank (
25-     capacity :  Int 
27+     capacity :  Int ,
28+     override  val  equipments :  List <String >
2629) : Container(capacity, 2000000 ..10000000 ) {
2730
2831    override  fun  containersNeededToPourIn (container :  Container ) =  if  (container is  Tank ) {
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments