Static Constructors

Saaa empty at needmail.com
Fri Oct 3 14:57:01 PDT 2008


I've been using classes for a few months now and I keep on making arrays of 
instances like:

class Fruit
{
this( parameters )
{
}
..
}

Fruits fruit[];

void init()
{
fruit.length=fruit.length+1; // annoys me :)
fruit[$]=new Fruit(  .. );
}

deleting is even more annoying.

Now I've been reading about static constructors and is that somehow a 
solution to this manual array management?





More information about the Digitalmars-d-learn mailing list