How to do "C++ classes"?

Ferhat Kurtulmuş aferust at gmail.com
Mon Sep 20 15:35:02 UTC 2021


On Saturday, 18 September 2021 at 22:16:32 UTC, Adam D Ruppe 
wrote:
> On Saturday, 18 September 2021 at 15:38:38 UTC, rempas wrote:
>> I'm seeing in the page about "BeterC" and in the part about 
>> the [retained 
>> features](https://dlang.org/spec/betterc.html#retained), the 
>> #11 says about "COM classes and C++ classes". What are the 
>> "C++ classes"? I tried to create a class using "extern(C++)" 
>> but this didn't worked. Can someone make an example on that?
>
> extern(C++)
> class Foo {}
>
> void main() {
>     scope Foo foo = new Foo();
> }

I thought it's stack-allocated and scoped. But when I try to 
return a class instance from a function, it still works? Captain 
Adam I need an explanation please.


More information about the Digitalmars-d-learn mailing list