C++'s this() equivalent?

Ali Çehreli acehreli at yahoo.com
Thu Jun 15 21:48:10 UTC 2023


On 6/15/23 08:15, zjh wrote:

 > I want `B` to become the following version similar to 'C++'. What should
 > I do?

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.

 > ```cpp
 > struct B{
 >      int m;
 >      B(){

Do you want to be able to use the name of the user-defined type to mean 
"constructor", "destructor", etc?

If so, no, it's not possible without preprocessing the text potentially 
with a C preprocessor.

And this is by design: In D, we rename the type and be done with it. In 
C++, one needs to rename a number of functions as well.

Ali



More information about the Digitalmars-d-learn mailing list