[Issue 21412] betterC mode program with C++ interface/class crashes

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 21 23:56:28 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21412

--- Comment #4 from Dibyendu Majumdar <mobile at majumdar.org.uk> ---
I assume you mean that it needs to be coded like this?

import core.stdc.stdio : printf;

extern (C++) abstract class A {
    void sayHello();
}

extern (C++) class B : A {
    override void sayHello() {
        printf("hello\n");
    }
}

extern (C) void main() {
    scope b = new B;
    b.sayHello();
}

This works

--


More information about the Digitalmars-d-bugs mailing list