I need to prevent other classes from instantiating...
# getting-started
p
I need to prevent other classes from instantiating the
Child
a
maybe you can just use an interface and discourage instantiating it directly?
Copy code
class Parent {
    companion object {
        fun foo(): Child = Us("field" )
    }

    interface Child {
        val field: String
    }

    private data class Us(override val field: String) : Child
}