Why is this allowed? Inheritance variable shadowing

Ola Fosheim Grostad ola.fosheim.grostad at gmail.com
Wed May 26 19:29:46 UTC 2021


On Wednesday, 26 May 2021 at 18:58:47 UTC, JN wrote:
> Is there any viable usecase for this behavior? I am not buying 
> the "C++ does it and it's legal there" argument. There's a 
> reason most serious C++ projects use static analysis tools 
> anyway. D should be better and protect against dangerous code 
> by default. I think a warning in this case would be warranted.

There are certainly many usecases fo static members, maybe that 
is why designers feel it should be allowed for instance members 
too?

I think this is a clear case of something that should produce a 
warning and provide a silencing annotation fo the cases where you 
really want it.




More information about the Digitalmars-d-learn mailing list