Is there a way to enforce an inheriting class provides a static property?
🇳🇴 3
b
bbaldino
11/21/2019, 11:02 PM
i've found myself wanting the same thing. you can have the companion object implement an interface though, if that helps.
(it didn't in my case 😕 )
h
Hullaballoonatic
11/22/2019, 3:25 AM
Yeah, in general I'd want the compiler to recognize that a class implementation has that static member
You can at the very least access static members of inheriting classes through reflection, accessing the property by the name, and recasting the erased type back into the one you expect, but that's really ugly and confusing to a reader