nested class inheritance
gor.f.gyolchanyan at gmail.com
Fri Jul 13 12:22:27 PDT 2012
On Fri, Jul 13, 2012 at 11:18 PM, Christophe Travert <
travert at phare.normalesup.org> wrote:
> Andrei Alexandrescu , dans le message (digitalmars.D:172280), a écrit :
> >> For Fruit.Seed it's Fruit, for AppleSeed it's Apple. This makes sense
> >> because the Apple, which AppleSeed sees is the same object, which
> >> Fruit.Seed sees as it's base type Fruit.
> > That would mean AppleSeed has two outer fields: a Fruit and an Apple.
> Only one. Apple. And when AppleSeed.super seed this Apple, it sees a
> AppleSeed a;
> assert(is(typeof(a.outer) == Apple));
> assert(is(typeof(a.super) == Seed));
> assert(is(typeof(a.super.outer) == Fruit));
> assert(a.outer is a.super.outer);
> If you can't figure out how can a.outer and a.super.outer have two
> different types, but be the same, think about covariant return.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Digitalmars-d