I am making an enum representing different tile types for a tile-based game, and I have a superclass which I want instances of tiles of inherit from. As I just found out, an enum can't extend or inherit from another class!
How can I get around this? My idea was that it might be possible to have the Tile-class be a normal class, and then have the enum in another class. Is this possible to accomplish, or do I need to solve the problem in another way?
You can use static fields of a class, for example:
class Directions {
static int LEFT = 0;
static int DOWN = 1;
static int RIGHT = 2;
static int UP = 3;
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments