Is there a way to construct a sealed class with re...
# getting-started
c
Is there a way to construct a sealed class with referenced children? Something like
Copy code
sealed class Seal {
    class InnerClass: Seal()
    ReferencedClass::class
}
k
So you want this to mean that
ReferencedClass
is a child of
Seal
?
c
Yup
k
Do you control
ReferencedClass
?
c
Yup
k
Then just move it into the sealed class file simple smile
c
In the sealed class file or the sealed class scope?
Because the point of the question is to be able to not have n number of child definitions all in one place
k
You can put all child definition in the sealed class' file, right?
c
No. sealed class' init is private. I'm inclined to believe that what I want is not possible. Would be nice to know why, though.