Wouldn’t a better solution here be to respect sealed
in this case. As for the more real world example, if you annotate your Items
class as final, you get an compile error for the wrong cases.
4 Likes
Wouldn’t a better solution here be to respect sealed
in this case. As for the more real world example, if you annotate your Items
class as final, you get an compile error for the wrong cases.