These are chat archives for JetBrains/kotlin
is there any difference between:
data class MyDataClass(val field:String) // and class MyClass(val field:String)
? I mean under the hood the generated classes are identical, or there are some other things that I need to consider? I'm not talking about semantic and anything, I just want to know what it is happing during compilation time :smile:
The compiler automatically derives the following members from all properties declared in the primary constructor: equals()/hashCode() pair, toString() of the form "User(name=John, age=42)", componentN() functions corresponding to the properties in their order of declaration, copy() function (see below). If any of these functions is explicitly defined in the class body or inherited from the base types, it will not be generated.