Sam Stone
07/26/2023, 8:16 PMopen class Foo(val a: Int) {
fun copy(a: Int = this.a) { ... }
}
class Bar(val a: Int, val b: Int): Foo(a) {
fun copy(a: Int = this.a, b: Int = this.b) { ... }
fun bar() {
copy() //IntelliJ redirects to Foo.copy
}
}
Jeff Lockhart
07/26/2023, 8:48 PMopen class Foo(val a: Int) {
fun copy(a: Int = this.a, nothing: Nothing? = null, nothing2: Nothing? = null) { ... }
}
Hacky, but works.Jeff Lockhart
07/26/2023, 8:56 PMcopy(a = something)
? I would make an explicit no argument function that you can explicitly override in the subclass, and call the class-specific private implementation from the public overridden API.