Construct immutable member in derived class

Alex sascha.orlov at gmail.com
Wed Apr 4 16:16:24 UTC 2018


On Wednesday, 4 April 2018 at 16:05:52 UTC, Timoses wrote:
> This becomes a bit hideous, unfortunately, when there are many 
> initializations involved.
>
> Found this, but it doesn't mention anything about derived 
> classes..
> https://dlang.org/spec/class.html#field-init

Here is something:
https://dlang.org/spec/class.html#constructors

By the rules 7 and 8 it is suggested, what Simen already said, 
the construction of the base class can be independent from the 
derived one. And as such, the immutability has to handled in the 
constructor, next to the variable...


More information about the Digitalmars-d-learn mailing list