I have created a data class
data class Something (
val a : String,
val b : Object,
val c : String
)
as later in my program, I need the string representation of this data class I tried to extend the toString
method.
override fun Something.toString() : String = a + b.result() + c
The problem here is, it does not allow extending (overriding) the toString
function, as it is not applicable to top-level functions.
How to properly override/extend the toString method of a custom dataclass?