What’s the deal with this? I thought that children of enum classes were objects, so they should be able to be referenced statically? Why would a getter be necessary when an instance of the enum class can never change? I can’t edit the image apparently, but I’ve added one that’s more clear in the thread below
matt tighe
07/31/2020, 7:56 PM
image.png
t
tseisel
07/31/2020, 8:00 PM
All enum constants are initialized in order when any of them is used for the first time. Since you are initializing a property of each constant whose value is immediately computed from Banana, Banana is not initialized yet. You have to use getters to make it work (just like