nested class inheritance

Gor Gyolchanyan gor.f.gyolchanyan at gmail.com
Fri Jul 13 12:08:43 PDT 2012


On Fri, Jul 13, 2012 at 11:02 PM, Era Scarecrow <rtcvb32 at yahoo.com> wrote:

> 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.
>

This all won't work, because having Fruit know about Apple defeats the
whole purpose.

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


More information about the Digitalmars-d mailing list