nested class inheritance

Gor Gyolchanyan gor.f.gyolchanyan at gmail.com
Fri Jul 13 11:30:33 PDT 2012


On Fri, Jul 13, 2012 at 10:19 PM, Andrei Alexandrescu <
SeeWebsiteForEmail at erdani.org> wrote:

> On 7/13/12 1:59 PM, Gor Gyolchanyan wrote:
>
>> Doesn't this make sense?
>>
>> class Fruit
>> {
>>      class Seed { }
>> }
>>
>> class Apple: Fruit
>> {
>>       class AppleSeed: Fruit.Seed { }
>> }
>>
>> This means, that as Fruit.Seed needs access to enclosing Fruit,
>> AppleSeed, being a Fruit.Seed will also have access to enclosing Fruit,
>> which is Apple.
>> DMD 0.259 has this to say:
>>
>> Error: class main.Apple.AppleSeed is nested within Apple, but super
>> class Seed is nested within Fruit
>>
>> Which doesn't make sense, IMO. What do you guys think about this? Who
>> makes more sense me or DMD 2.059?
>>
>
> Untested:
>
> class Fruit
> {
>     static class Seed { }
> }
>
> class Apple: Fruit
> {
>      static class AppleSeed: Fruit.Seed { }
> }
>
>
> Andrei
>

The whole point is to have it not static. I need it to be properly nested
with the this.outer.

-- 
Bye,
Gor Gyolchanyan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120713/4ca1af13/attachment.html>


More information about the Digitalmars-d mailing list