I want an enum that holds a variable. Is that possible? (Example: Enum of Male or Female, but with a variable "height" that gets passed in constructor)
v
Vampire
10/08/2020, 3:38 PM
You can do that, but all male will have the same height and all female will have the same height
Vampire
10/08/2020, 3:38 PM
If that's not what you want, you are most probably more after sealed classes
👆 1
v
Valentin Metz
10/08/2020, 3:38 PM
Ah. Thx for the pointer! - I want height to be individual.
v
Vampire
10/08/2020, 3:39 PM
The sense of an enum is that it is an enumeration, so there is exactly one time "male" and one time "female", so yeah, sealed class is it probably
v
Valentin Metz
10/08/2020, 3:39 PM
Thx. Seems to be exactly what I need.
v
Vampire
10/08/2020, 9:38 PM
It's neither good behavior to hijack foreign threads with loosely coupled topics, nor to ping random people just to get an answer. I doubt you are interested in specifically my opinion, especially as I'm also relatively new to Kotlin.
Better start a separate thread without ping.