What is considered the "clean" way to address this error:

```
tst60.d(7): Error: class `tst60.B` cannot implicitly generate a default constructor when base class `tst60.A` is missing a default constructor
```

Yes, this is a toy example, but it reflects something I'm doing in actual code. The subclass has no state, thus it's fine to let the superclass take care of initialization. Do I really need a shim like this:

```d
    this(int val) {
        super(val);
    }
```

In my class B just to placate the compiler? Is this considered the idiomatic way to deal with such a class organization?

```d
class A {
    int v;
    this(int val) {
        this.v = val;
    }
}
class B : A {
    int myfunc() {
        return this.v;
    }
}
int main() {
    auto b = new B(1);
    return b.myfunc();
}
```

Reply via email to