Default values in derived class

JN 666total at wp.pl
Sat Dec 28 22:57:13 UTC 2019


On Saturday, 28 December 2019 at 22:12:38 UTC, Johan Engelen 
wrote:
> What Mike is saying is that `Base` has one `b` member variable, 
> but `Derived` has two (!).
>
> ```
> writeln(d.b); // false
> writeln(d.Base.b); // true (the `b` member inherited from Base)
> ```
>
> -Johan

That makes sense. I think the compiler/linter should be warning 
against such cases though, because it's easy to make mistakes 
this way.


More information about the Digitalmars-d-learn mailing list