In the code example below, I'm trying to test the value of an enum in the parent class. The error I get is "p.theEnum cannot be resolved or is not a field.", but it's the exact same code I use in the parent class to test the value (without the p. obviously).
Where am I going wrong? :)
public class theParent {
protected static enum theEnum { VAL1, VAL2, VAL3 };
private theEnum enumValue = theEnum.VAL1;
theParent() { this.theChild = new theChild(this); this.theChild.start(); }
class theChild {
private parentReference p;
public theChild (theParent parent) { this.p = parent; }
public void run() {
// How do I access theEnum here?
if (p.enumValue == p.theEnum.VAL1) { }
}
}
}