I have an interface where I want a property that can be changed inside the class, but not outside. I cannot use val because it must be mutable and the var keyword cannot have a specific private installer, as it is in the interface.
In Java, I would do this:
public <T> getMyProperty();
I can use the same approach in kotlin and just write the getter function directly, but this does not look like a kotlin-like approach. Is there a better way to achieve the same as this?
fun getMyProperty()
source
share