Shadowing member in inheritance hierarchy - why
user1234
user1234 at 12.de
Sat Aug 9 01:33:03 UTC 2025
On Friday, 8 August 2025 at 23:52:31 UTC, Brother Bill wrote:
> D language supports shadowing members, where the shadowed
> member has same name and different type on same type.
>
> Why is this enabled, and when should one use this advanced
> technique?
That's not considered as shadowing as you can distinguish the two
members using a qualified access chain.
```d
class A {int m = 1;}
class B.A {float m;}
assert((new B).A.m == 1);
```
More information about the Digitalmars-d-learn
mailing list