class array

orgoton orgoton at mindless.com
Tue Mar 20 10:16:10 PDT 2007


I created a class and now I want to create an array (at compile time) so I did 

public myClass myArray[]=new myClass(5);

It didn't compile because of the parameters, so I changed to

public myClass myArray[]=new myClass()(5);

Since myClass ctor doesn't take parameters. It mentioned that was expecting ";" and found "(" so I tried the C++ way

public myClass myArray[]=new[5] myClass();

Then again, "[" wasn't expected. How do I then construct 5 objects?


More information about the Digitalmars-d-learn mailing list