nested class inheritance
Guillaume Chatelet
chatelet.guillaume at gmail.com
Sat Jul 14 05:11:52 PDT 2012
On 07/14/12 13:51, Andrei Alexandrescu wrote:
> On 7/14/12 5:36 AM, Guillaume Chatelet wrote:
>> 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);
>> }
>> }
>>
>> This is valid Java code actually and I agree with Gor I would have
>> expected it to work with D.
>>
>> Guillaume
>
> You may want to add the example to the bug report.
>
> Thanks,
>
> Andrei
Done.
http://d.puremagic.com/issues/show_bug.cgi?id=8389
Guillaume
More information about the Digitalmars-d
mailing list