dynamic array creation

orgoton orgoton at mindless.com
Wed May 9 10:22:25 PDT 2007


Assume "Foo" to be a class:
> int[] ar = new int[10];
If you put 
foo[] ar=new foo[10];
will will generate an array with 10 _instances_ of foo (using default ctor).

> int[] ar;
> ar.length = 10;
Using foo[] ar;
ar.length=10;
will generate an array of _references_ (all null) without instantiating foo.

I'd prefer if someone would confirm this.


More information about the Digitalmars-d-learn mailing list