nested class inheritance
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Fri Jul 13 11:19:17 PDT 2012
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
More information about the Digitalmars-d
mailing list