Proper desctructor for an class containing dynamic array of objects
XavierAP
n3minis-git at yahoo.es
Fri Jun 14 13:31:25 UTC 2019
On Friday, 14 June 2019 at 11:10:58 UTC, rumbu wrote:
> On Friday, 14 June 2019 at 07:52:24 UTC, Marco de Wild wrote:
>> On Thursday, 13 June 2019 at 16:08:52 UTC, Mike wrote:
>> Opposed to Java, D's member variables are static initialised.
>
> Is there any documentation about this? I find it unexpected.
https://dlang.org/spec/class.html#static-constructor
«All member initializations must be determinable by the compiler
at compile time, hence there is no order-of-evaluation dependency
for member initializations, and it is not possible to read a
value that has not been initialized. Dynamic initialization is
performed by a static constructor»
More information about the Digitalmars-d-learn
mailing list