How can I make nested class constructors accessible only by surrounding class?

:smiley: finally i see:


you don’t need private constructor and fabric for inner class, because your public constructor of inner class is a factory itself
scoped privacy gives you a nicer strict fabric for java-styled code with scala, but you got correctly created inner instance without it (as mentioned you also don’t need to store container for inner class, it already stored)
so “inner class” is more “kotlin” way to make nested instance, it’s always produced by defined parent instance, it’s always have access to it, and you cant “avoid to invoke” fabric when consructor is a fabric

1 Like