Using host variables in C++

A similar situation arises when using host variables within C++ classes. It is frequently convenient to declare your class
in a separate header file. This header file might contain, for example, the following declaration of my_class.

In this example, each method is implemented in an embedded SQL source file. Only simple variables can be used as host variables.
The technique introduced in the preceding section can be used to access a data member of a class.

The above example declares this_host_member for the SQL preprocessor, but the macro causes C++ to convert it to this->host_member. The preprocessor would otherwise not know the type of this variable. Many C/C++ compilers do not tolerate duplicate declarations.
The #if directive hides the second declaration from the compiler, but leaves it visible to the SQL preprocessor.

While multiple declarations can be useful, you must ensure that each declaration assigns the same variable name to the same
type. The preprocessor assumes that each host variable is globally known following its declaration because it can not fully
parse the C language.