rrader
06/17/2019, 3:00 PMinterface Some {
fun calculate(str: String? = null)
}
class SomeImpl : Some {
fun calculate(str: String? = null)
}
An overriding function is not allowed to specify default values for its parameters
Why?Luke
06/17/2019, 3:07 PMLuke
06/17/2019, 3:10 PMrrader
06/17/2019, 3:10 PMLuke
06/17/2019, 3:11 PMstreetsofboston
06/17/2019, 3:19 PMrrader
06/17/2019, 8:10 PMstreetsofboston
06/17/2019, 8:17 PMrrader
06/17/2019, 9:08 PMstreetsofboston
06/17/2019, 9:10 PMcalculate(...) functions, calls it on a variable that is declared to be of type Some, correct, not of type SomeImpl?
val mySome : Some
...
...
mySome = ... SomeImpl() ...
...
mySome.calculate()rrader
06/18/2019, 6:33 AMSomeImpl, why not?streetsofboston
06/18/2019, 11:51 AMSome instances (they should not be concerned with the specific implementation of an interface).