Is there a way to make a write-only property? Just...
# getting-started
k
Is there a way to make a write-only property? Just leaving out the getter doesn't work, and having it throwing an exception isn't a compile-time error.
l
What if you make a private getter method?
k
Ah, interesting idea. I'll see if that works, thanks!
@little Unfortunately that doesn't work, there's an issue about it: https://youtrack.jetbrains.com/issueMobile/KT-3110
l
package test public class Test() { public var str2: String? = null public set(value) { field = value } //why you used str1? private get } fun main(args: Array<String>) { Test().str2 = "Test" // INVISIBLE_MEMBER I am not in a computer to try it myself, but give a try and let me know!