# Field with private getter & public setter

**URL:** <https://discuss.kotlinlang.org/t/field-with-private-getter-public-setter/11070>\
**Category:** Language Design\
**Created:** [January 8, 2019, 5:49pm UTC](https://discuss.kotlinlang.org/t/field-with-private-getter-public-setter/11070 "2019-01-08T17:49:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xerus](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/xerus/32/4499_2.png) [@Xerus](https://discuss.kotlinlang.org/u/Xerus)\
**Post date:** [January 8, 2019, 5:49pm UTC](https://discuss.kotlinlang.org/t/field-with-private-getter-public-setter/11070/1 "2019-01-08T17:49:38Z")

</div>

I have a lateinit property, that should only be able to be set from the outside but not accessible.

```auto
private lateinit var string: String
	public set

```

Why does the setter have to have a less permissive visibility than the field? Now I have to write it like this, which is kind of ugly:

```auto
private lateinit var string: String
fun setString(string: String) {
	this.string = string
}

```
