how do I create an array of objects as member of class?

Assembly via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jun 26 14:50:28 PDT 2015


Imaginary code:

class Foo { }
class Baa {
   Foo a = new Foo();
   Foo b = new Foo();
   Foo[] l = [a,b];
}

What should I use instead of to it work? Array!Foo(a,b) didn't 
worked either.

I know this works:

class Baa {

Foo a = new Foo();
   Foo b = new Foo();
Foo[] l;

this() {
  l = [a,b];
}

But I'd like to initializa it at declaration time


More information about the Digitalmars-d-learn mailing list