Adding a new design constraint to D

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Tue Jun 14 12:39:26 UTC 2022


On Tuesday, 14 June 2022 at 12:33:53 UTC, Mike Parker wrote:
> On Tuesday, 14 June 2022 at 12:28:24 UTC, Ola Fosheim Grøstad 
> wrote:
>> On Tuesday, 14 June 2022 at 12:19:40 UTC, Mike Parker wrote:\
>>> And Paul did show you how to do that with `child.Foo._c`.
>>
>> Which is a pointless thing to say, you are still violating the 
>> subtyping relationship.
>
> So then what do you do when your direct access to `child._c` 
> suddenly starts causing a subtle bug because someone added 
> later added a `_c` member to the public interface of `Bar`? 
> Private members are not inherited and do not impact the public 
> interface.

You get an error, just like in C++!

Then you disambiguate.

(Private members are inherited 100%.)



More information about the Digitalmars-d mailing list