https://kotlinlang.org logo
j

Jakub

12/06/2018, 10:15 AM
1) Implement getter with logic
m

marstran

12/06/2018, 10:55 AM
Why not just this?
Copy code
data class User(val firstName: String, val lastName: String) {
    val fullName = "$firstName $lastName"
}
👍 1
☝️ 1
a

Alan Evans

12/06/2018, 1:03 PM
I'm going to be that annoying I18N guy: some cultures put the last name first. For that reason too,
givenName
and
surname
are better property names.
👍 1
j

Jakub

12/06/2018, 1:32 PM
haha, that's only an example, but thanks @Alan Evans Valid point!
😁 1