Smorg
01/24/2019, 1:31 PMclass V {
fun doSomething() {
...
}
sealed class S {
object S1: S() {
// how can I possibly do below:
init {
doSomething()
}
}
}
}
I know for a regular class, I just need to declare it as inner and call the regular outer class methods from itmarstran
01/24/2019, 1:38 PMSmorg
01/24/2019, 1:42 PMmarstran
01/24/2019, 1:49 PMobject
, because the object needs a reference to an instance of the outer class (so you would need one singleton object for every instance of V, which is contradictory).class V {
fun doSomething() {
...
}
}
sealed class S(val v: V) {
class S1(v: V): S(v) {
init {
v.doSomething()
}
}
}
Smorg
01/24/2019, 1:56 PMclass V {
fun doSomething() {
...
}
sealed class S {
class S1(v: V): S() {
init {
v.doSomething()
}
}
}
}