the only way of having backing properties is doing...
# getting-started
i
the only way of having backing properties is doing something like this?
Copy code
class C {
    private val _elementList = mutableListOf<Element>()

    val elementList: List<Element>
         get() = _elementList
}
m
It depends if you want to cast MutableList to List, but you can also: 1. Create a method
Copy code
fun elements(): List<Double> = elements.toList()
2. If you don't want to change into immutable list, then
Copy code
var elements = mutableListOf<Double>()
        private set
3. Or if you want to have it visible, then simply:
Copy code
val elements = mutableListOf<Double>()