Function call in object
I am trying to understand the code snippet below(removed some not relevant bits).
When ‘status’ is called, why is ‘toString(): String’ function called too? What calls it?
data class ParkingLot(val size: Int) {
data class Car(val plate: String, val color: String) {
override fun toString() = "$plate $color"
}
data class Spot(val spotNumber: Int, val isFree: Boolean, val car: Car?) {
override fun toString() = "$spotNumber $car"
}
private val parkingData =...