Nested Classes with inheritance

user1234 user1234 at 12.de
Sat Mar 19 12:23:02 UTC 2022


On Saturday, 19 March 2022 at 05:25:01 UTC, Era Scarecrow wrote:
> On Saturday, 19 March 2022 at 00:16:48 UTC, user1234 wrote:
>> That crashes because of the creation of `Bar b` member, which 
>> itself has a Bar b member, which itself...
>
>  Mhmm... So There's Foo with Bar b, which has Bar b which has 
> Bar b which... just keeps going over and over again.
>
>  It appears to me that it only crashes when you fully run out 
> of memory then. Much like a function calling itself and you 
> exhaust all your stack space.
>
>  I'd suggest avoiding self-inheritance. No one wants to be 
> their own Grandpa

I think OP is learning OOP. His error looks like that for the 
least.


More information about the Digitalmars-d-learn mailing list