Tower Guidev2
08/04/2021, 2:29 PMwhen
I have a sealed class of values and want to identify each case as shown below
*when*(x) {
*is* SealedInitial -> doNothing()
*is* SealedOne -> something(x.value)
*is* SealedTwo -> somethingElse(x.value)
*else* -> doNothing()
}
I have to perform this test "All Over" my application, however the only constant check I will always need is
the first one, e.g. *is* SealedInitial -> doNothing()
I would like to have thi scase handled by a super class so that all my Sub Classes do not need to keep coding that line
Is this possible? To have a when
statement "extend" a super when
?Ruckus
08/04/2021, 2:36 PMPost links to interesting things about Kotlin. Discuss in the relevant channel, not here.This channel is meant to be more of a news feed than a discussion area.
Tower Guidev2
08/04/2021, 2:37 PMRuckus
08/04/2021, 2:38 PMTower Guidev2
08/04/2021, 3:13 PM