https://kotlinlang.org logo
Title
j

John Guerra

09/20/2020, 1:59 AM
Another dumb question: If a class contains data of an entity (Such as their position, etc.) would it be viable to just make it a data class? There is nothing in the constructor as everything within is practically modifiable fields to update things such as their current position.
d

deactivateduser

09/20/2020, 2:30 AM
sounds like a candidate for a
data class
to me. You can probably use this approach: https://pl.kotl.in/IIZFSE11m
this works as well: https://pl.kotl.in/bg-6FXofr
v

Vampire

09/20/2020, 8:57 AM
Why two constructors though? https://pl.kotl.in/ZN1VvP8Ob
d

deactivateduser

09/20/2020, 9:07 AM
i couldn’t even understand myself why I posted the solution with 2 constructors 🤷, hence the second link I posted….
v

Vampire

09/20/2020, 9:23 AM
Oh, somehow missed the second one o_O