I want to define a class with a constructor that takes an enum as a formal argument (so only arguments which conform with the enum type can be passed). Here's what I have (generalised as I'm doing college work and don't want to plagiarise):
public class EnumThing
{
private SomeConstant aConstant;
private enum SomeConstant {CONSTANT1, CONSTANT2, CONSTANT3};
public EnumThing(SomeConstant thisConstant)
{
this.aConstant = thisConstant;
}
// Methods
However when I try
EnumThing doodah = new EnumThing(CONSTANT1);
I get an error: cannot find symbol - variable CONSTANT1
This is my first attempt to use enums for anything at all. They seem excitingly powerful but it seems like I'm using them wrong. Any help hugely appreciated!