Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?
martin
martin at mab-on.net
Wed Apr 11 17:20:23 UTC 2018
On Monday, 9 April 2018 at 17:16:56 UTC, bauss wrote:
> On Monday, 9 April 2018 at 17:05:45 UTC, martin wrote:>>
>> Actually, this behaves as i would expect.
>> `_baz` is a private member of Foo (to be precise: it belongs
>> to module `a`)
>> in handleBar(), you iterate `Bar[]` - which is in module `b`.
>> By casting it to Foo, you are accessing the wanted module
>> (`a`) again.
>
> but handleBar() is in a.
>
> This behavior is allowed in ex. C#
`_baz` is a member of `module a : Foo` - `_baz`, as is
`handleBar()`.
`protected` is the Access specifier you want.
If i understand you correctly, you want it to behave as if
`_baz` would be a member of `handleBar()`
If this is really possible in C#, it lets my eyebrow raise.
More information about the Digitalmars-d
mailing list