Outer class reference oddity?

Manu turkeyman at gmail.com
Sat Aug 24 17:41:42 UTC 2024


On Sat, 24 Aug 2024 at 13:36, Walter Bright via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

> The reason the inner class feature exists is to support translation from
> Java
> code which used inner classes. (It doesn't exist in C++.)
>
> Ok, so there is only one outer. This illustrates how confusing this
> example is
> (at least to me!)
>
>
>  > it is typed as the base type, and not as the derived type which was
> assigned
> on creation.
>
> It is indeed typed as the static type, not the dynamic type.
>
> I encourage you to submit it to bugzilla.
>
> I suggest just adding the Outer2 qualification, and move on. Or use an
> alternate
> method such as interfaces or aggregation.
>

I logged a bug... and then after I did, I realised that I had already
logged one before; so you've got 2 now! That should be twice the motivation
to fix it ;)

I have moved on... but the reason I bring it up is because it's a cool
advertised feature, and for the first time in my life, I had a situation
where it seemed immensely useful!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20240825/5e44acf1/attachment.htm>


More information about the Digitalmars-d mailing list