I am trying to have a field of a class that can ge...
# getting-started
s
I am trying to have a field of a class that can get publicly, but only set privately. I know the following works:
Copy code
class Test2 constructor(val id:Long,i_description:String){
    var description = i_description
        private set
}
I was hoping to find a way without having 2 different fields. Something a bit more like
class Test1 constructor(val id:Long,var description:String private set)
, which doesn't work. Is 2 fields the only way?