Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

__identifier

Enables the use of C++ keywords as identifiers.

__identifier(C++_keyword)

Remarks

The __identifier keyword enables the use of C++ keywords as identifiers. The main purpose of this keyword is to allow managed classes to access and use external classes that may use a C++ keyword as an identifier. For more information on __identifier, see 22 __identifier Keyword.

Note   Use of the __identifier keyword for identifiers that are not keywords is permitted, but strongly discouraged as a matter of style.

Example

In the following example, a C# class (called template) is created and assigned to pTemplate:

// identifier_template.cs
// compile with: /target:library
public class template
{
   public void Run()
   {
   }
}
// keyword__identifier.cpp
// compile with: /clr
#using <mscorlib.dll>
#using <identifier_template.dll>   // defines a C# class called template

int main()
{
   __identifier(template) *pTemplate = new __identifier(template)();
   pTemplate->Run();
   return 0;
}

See Also

Managed Extensions for C++ Reference | C++ Keywords

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.