how to make private class member private

psychoticRabbit meagain at meagain.com
Tue Mar 13 06:35:58 UTC 2018


On Tuesday, 13 March 2018 at 06:26:13 UTC, Radu wrote:
> On Tuesday, 13 March 2018 at 06:14:49 UTC, psychoticRabbit 
> wrote:
>> On Tuesday, 13 March 2018 at 06:01:43 UTC, ketmar wrote:
>>>
>>> ah, yes, sorry: i completely forgot that C++ was invented 
>>> after c# and java. mea maxima culpa!
>>
>> My point was, that the 2 most widely used and popular 
>> languages on the plant, C# and Java, decided NOT to make 
>> private, something mean else, like D has done.
>>
>> So the 3 most used languages got it wrong??
>
> Yes, they got it wrong! Because they don't have modules, and 
> because Java & C# are OOP bondage-everything-is-a-class, and 
> preach that the world spins on classes.
>
> C++ tried to fix it with 'friend', and it shows the hack that 
> it is.
>
> Don't know why you think D should be just another Java or C#?

Well I don't really. But one of the great things about D, is that 
a C++/C#/Java programmers can jump right in.

But when the same syntax suddenly means something really 
different, I tend to think that's not a good design decision.

And that's really the main point of my argument.

As I said, this was a real gotcha for me.

I only realised after I accidently tried to modify a private 
member directly, and discovered I did actually modify it!

Maybe, a different modifier that made it private to the module 
would have been a better design decision.




More information about the Digitalmars-d-learn mailing list