Hi,

Why in D this expression does not call the class constructor?

class A {

    int myVal;

    this(int val) {
       myVal = val;
    }

}


int main() {
   A myA = 8;
}


I would like to have a feature like this, because i want to create my own data type. I think it's possible, but i don't know why... std.variant, can be initialized like this.

Thanks!

Reply via email to