I have code like this:
public abstract class Foo {
public static Foo getFoo() {
return new FooImpl();
}
abstract void DoFoo();
private class FooImpl extends Foo {
public FooImpl() { }
@Override
void DoFoo() { }
}
}
But Eclipse is telling me. No enclosing instance of type Foo is accessible.So, how can I get this to work?
I tried to make it as simple as possible to see if it will compile:
public abstract class Foo {
public static Foo getFoo() {
return new FooImpl();
}
private static class FooImpl extends Foo {
public FooImpl() { }
}
}
And I still get the same error. What am I missing?
CORRECTED! I changed the line return new FooImpl();toreturn new Foo.FooImpl();
source
share