http://d.puremagic.com/issues/show_bug.cgi?id=8389


Guillaume Chatelet <chatelet.guilla...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chatelet.guilla...@gmail.co
                   |                            |m


--- Comment #1 from Guillaume Chatelet <chatelet.guilla...@gmail.com> 
2012-07-14 05:09:35 PDT ---
Indeed. The following is valid Java code and I would have expected it to work
with D too as D took the Java way for OOP.

class Fruit {
    class Seed {
    }
}

class Apple extends Fruit {
    class AppleSeed extends Fruit.Seed {
        Apple getOuter() {
            return Apple.this;
        }
    }
}

class Main {
    public static void main(String[] args) {
        final Apple apple = new Apple();
        final Apple.AppleSeed appleSeed = apple.new AppleSeed();
        assert (appleSeed instanceof Fruit.Seed);
        assert (apple == appleSeed.getOuter());
        assert (appleSeed.getOuter() instanceof Apple);
        assert (appleSeed.getOuter() instanceof Fruit);
    }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to