nested class inheritance

Era Scarecrow rtcvb32 at yahoo.com
Fri Jul 13 12:02:02 PDT 2012


On Friday, 13 July 2012 at 18:55:28 UTC, 
travert at phare.normalesup.org (Christophe Travert) wrote:
> "Era Scarecrow" , dans le message (digitalmars.D:172272), a 
> écrit :
>>   Then perhaps have the inherited class within fruit?
>> 
>> class Fruit {
>>    class Seed {}
>>    class Appleseed : Seed {}
>> }
>
> But then AppleSeed doesn't know about Apple....

So I forgot the apple :P But then inner inheritance won't work.

  class Fruit {
   class Seed {}
   class Apple {
    class Appleseed : Seed {} //same error as before
   }
  }

  If you make seed static, then Appleseed & apple will have access 
to Fruit but seed (by itself) won't. Other combinations faile as 
far as I can tell. How far you can take inner class inheritance I 
don't know, but it seems not that many levels.


More information about the Digitalmars-d mailing list