C++'s this() equivalent?

zjh fqbqrr at 163.com
Fri Jun 16 00:41:07 UTC 2023


On Thursday, 15 June 2023 at 21:48:10 UTC, Ali Çehreli wrote:

> I have difficulty understanding the question. I think the 
> nested structs, extern(C), static members, etc. confuse me. I 
> am assuming they are not related to this question.
>

>
> Ali


I used the `class` to call the` constructor/destructor 
(destroy)`, but after they leave the scope, they do not call 
the`destructor (destroy)`.
`Nested class` is because I want to directly use members of 
`external struct`, but in reality, I cannot access them directly. 
Therefore, I only have to use ` static members`,.
`extern(C)` is to use `BetterC`,.

The purpose is mainly to complete `RAII`, completing one part of 
the work after entering the scope and another part of the work 
after leaving the scope.



More information about the Digitalmars-d-learn mailing list