Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?
bauss
jj_1337 at live.dk
Tue Jun 12 13:47:51 UTC 2018
On Monday, 11 June 2018 at 15:41:57 UTC, Steven Schveighoffer
wrote:
> On 4/11/18 3:13 PM, bauss wrote:
>> On Wednesday, 11 April 2018 at 17:58:25 UTC, Jonathan M Davis
>> wrote:
>>> On Sunday, April 08, 2018 13:00:02 bauss via Digitalmars-d
>>> wrote:
>>>> [...]
>>>
>>> I don't know. It could be argued either way. I think that the
>>> logic as to why
>>>
>>> [...]
>>
>> The thing is, it makes no sense why it shouldn't be legal
>> since you can just cast to the base type, by that alone you're
>> escaping the restriction that it's supposed to have.
>>
>> And it really goes against that private is module level.
>>
>> If it was module level then you should be able to access the
>> member regardless of the reference to it.
>
> Just going through old messages on the NG.
>
> I filed a bug about a similar thing (calling private functions
> instead of using private variables), but it seemed to be agreed
> upon that this is expected behavior:
>
> https://issues.dlang.org/show_bug.cgi?id=15897
>
> You may find some more insight from reading that discussion. I
> don't agree with the conclusion, as it is very surprising
> behavior to me.
>
> -Steve
It goes against everything OOP and it goes against D's own
private.
More information about the Digitalmars-d
mailing list