Is there any difference between nested sealed sub-...
# getting-started
i
Is there any difference between nested sealed sub-classes and not nested sub-classes except for the way sub-classes are accessed?
t
AFAIK there is no difference. Historically sealed subclasses were only allowed when nested. This limitation was later removed to allow subclasses to be defined in the same file, for convenience.
k
Non-nested interact differently with the parent class’s init block, but I can’t remember the details. All I know is weeks ago I was getting some error regarding accessing parent
init
for non-nested, but when I made it a nested sealed class instead, the error went away.
t
@kyleg That's a rather strange behavior. Would you mind sharing the code that failed ? It may be a bug.
k
I don’t think I can. I ran into this weeks ago and definitely have refactored since. I think I was trying to do some sealed class stuff related to JB Exposed tables or entities.