william
06/29/2020, 2:36 PMsomeComputationUsingA(a)
while still being able to pass it to the super constructor and being able to access it in FooSubType
class FooSubType(
val a: Int,
val b: String
): FizzSuperType(
someComputationUsingA(a) + " $b"
)
In the above its only passed along and I can't access the original result of the computation. I'm a little unsure about how to retain it in FooSubType
to access at a later timewilliam
06/29/2020, 2:37 PMwilliam
06/29/2020, 2:42 PMclass FooSubType(): FizzSuperType {
val computation = someComputationUsingA(a)
constructor(val a: Int, val b: String): FizzSuperType(computation)
}
william
06/29/2020, 2:43 PMthis
before the supertype is initialized i am unsure what the workarounds arediesieben07
06/29/2020, 2:50 PMdiesieben07
06/29/2020, 2:54 PMMichael de Kaste
06/29/2020, 2:55 PMclass FooSubType private constructor(val a: Int, val b: Int, val computation: Int): FizzSuperType(computation) {
constructor(a: Int, b: Int) : this(a,b,someComputationUsingA(a))
}
Michael de Kaste
06/29/2020, 2:55 PMwilliam
06/29/2020, 3:04 PM