Implement inner non-static interface

Viewed 61

I would like to instantiate an an inner non-static interface from outside the wrapping class.

Is this possible?

Consider the following code:

shared class AOuterClass() {
Integer val = 3;
shared interface AInterface {
        shared Integer val => outer.val;
    }
}

void test() {
    AOuterClass o = AOuterClass();
    object impl satisfies ???.AInterface{}
}

I think object impl satisfies o.AInterface{} would be my reasonable intuition, but the compiler does not allow it.

1 Answers
Related