Weed Wrote:

> Kagamin ÐÉÛÅÔ:
> > Weed Wrote:
> > 
> >>> Global variables are static members of module, wich is similar to
> >>> class and also has static constructor.
> >> So what?
> > 
> > So your problem is solved.
> 
> If everything was so simple! :)
> 
> Once again: the static constructor of class NOT constructs an object.

Static constructor can execute any valid D statements including construction of 
objects.
This works:
---
import std.stdio;

class Matrix
{
        int i;

        this(int j)
        {
                i=j;
        }
}

Matrix m;

static this()
{
        m=new Matrix(7);
}

void main()
{
    writeln(m.i);
}
---

Reply via email to