LastExceed
04/01/2022, 6:48 AMinterface I {
fun foo(x: Int)
}
class C : I {
override fun foo(x: Int, y: Int = 0) {}
}
basically sugar for
override fun foo(x: Int) = foo(x, 0)
fun foo(x: Int, y: Int) {}
therealbluepandabear
04/01/2022, 10:41 AMoverride
.LastExceed
04/01/2022, 10:42 AMtherealbluepandabear
04/01/2022, 10:45 AMLastExceed
04/01/2022, 10:48 AMtherealbluepandabear
04/01/2022, 10:56 AMLastExceed
04/01/2022, 10:58 AMtherealbluepandabear
04/01/2022, 11:02 AMLastExceed
04/01/2022, 11:12 AMmcpiroman
04/01/2022, 11:54 AMlhwdev
04/01/2022, 1:54 PMfun foo(a: Int, b: Int = 1, c: String = "2")
? Should it override all the couterparts like foo(a)
, foo(a, b)
, foo(a, b, c)
, foo(b, c)
?
• If we have both fun foo(x)
and fun foo(x, y)
in parent, override fun foo(x, y = 1)
overrides only foo(a, b)? or overrides both?LastExceed
04/01/2022, 2:23 PMstantronic
04/01/2022, 5:38 PMval something
, and a fun getSomething
in the same classmcpiroman
04/01/2022, 6:16 PMfun foo(x)
and `fun foo(x = 1)`anyway, so 2) should not be supported for override