// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class MultiInterf {
    public static void main(String[] args) {
        A o = new A();
        System.out.println(o.asB().f());
        System.out.println(o.asC().f());
    }
}

interface B {
    Object f();
}

interface C {
    boolean f();
}

class A {
    public Object fB() {
        return null;
    }
    public boolean fC() {
        return false;
    }
    public B asB() {
        return new AB(this);
    }
    public C asC() {
        return new AC(this);
    }
    private static class AB implements B {
        private A real;
        public AB(A real) {
            this.real = real;
        }
        public Object f() {
            return real.fB();
        }
    }
    private static class AC implements C {
        private A real;
        public AC(A real) {
            this.real = real;
        }
        public boolean f() {
            return real.fC();
        }
    }
}
