Make a class instantiable only in own file

I don’t think there’s a clean solution to this in Kotlin. One thing that can be done is:

private object Foo

class C(p: Foo) : I1, I2 { ... }

Nobody can call C() from the outside, because Foo is private to this file

1 Like