_CreatingClassInstance

Top  Previous  Next

What is translated > class-reference type > Other compiler ClassRef > _CreatingClassInstance

To simulate class references in C++, a hierarchy of default constructed class instances can be used. However, the construction of these instances may have unwanted side effects or the construction can fail, if certain conditions are not yet met, such as the existence of certain global variables. In such cases the global boolean variable

 

bool _CreatingClassInstance;

 

which is defined in d2c_sysmeta can be used. Before the class reference simulating class instance is constructed, this variable will be set to true automatically and afterwards it will be set to false again. You may modifiy the code for the constructor like

 

 

XXX::XXX

{

if (_CreatingClassInstance)

   return;

 

...

}



This page belongs to the DelphiXE2Cpp11 Documentation

DelphiXE2Cpp11 home  Content