I have an abstract class
with a variable like follows:
public abstract class MyAbstractClass {
int myVariable = 1;
protected abstract void FunctionThatUsesMyVariable();
}
Then when I go to instantiate my class
through the following code, myVariable
cannot be seen:
MyAbstractClass myClass = new MyAbstractClass() {
@Override
protected void FunctionThatUsesMyVariable() {
// TODO Auto-generated method stub
}
};
What am I doing wrong and how can I achieve what I am trying to achieve?