On Wednesday, 28 September 2022 at 19:57:10 UTC, Riccardo M wrote:
I think I am stuck in the easiest of the issues and yet it seems I cannot get around this.
I have a C++ file:
```
class MyClass {
public:
    int field;
    MyClass(int a) : field(a) {}

    int add(int asd) {
        return asd + 1;
    }
};
```

Ali is correct. However, you don’t have to change anything on the C++ side, just map C++ class to D struct:
```D
extern(C++, class) {
    struct MyClass {
    public:     
        int field;
        @disable this();
        int add(int asd); //struct fields are always `final`
    }

    MyClass* instantiate(int asd); //mind the *
}
```

Reply via email to