Why is D unpopular
mw
mingwu at gmail.com
Mon Jun 13 14:10:48 UTC 2022
On Monday, 13 June 2022 at 13:51:40 UTC, Paul Backus wrote:
>
> This is necessary because D allows you to define fields with
> the same name in a base class and its derived class; for
> example:
>
This is horrifying, one of the darkest corner of D.
> ```
> class Base
> {
> int x = 123;
> }
>
> class Derived : Base
> {
> int x = 456;
> }
>
> void main()
> {
> auto instance = new Derived;
> assert(instance.x == 456);
> assert(instance.Base.x == 123);
> }
> ```
More information about the Digitalmars-d
mailing list