Community Goodies: Resource Index for Language Features of C++/CLI

SUMMARY C++/CLI is a self-contained, component-based dynamic programming language that, like C# or Java, is derived from C++; it is a binding of C++ to Microsoft’s .NET programming environment. This article is to give you a brief introduction of the language features of C++/CLI.
CLR Data Types

CLR types are prefixed with an adjective that describes what sort of type it is. The following are examples of CLR data type declarations in C++/CLI.

  • Reference types

      ref class RefClass{...};

      ref struct RefClass{...};

  • Value types

      value class ValClass{...};

      value struct ValClass{...};

  • Interfaces

      interface class IType{...};

      interface struct IType{...};

  • Enumerations

      enum class Day{...};

      enum struct Day{...};

  • Properties

      property int Property_Block


             int get();

             void set(int value)


                    MyInt = value;



  • Delegate
   public delegate void MyDel(…);
  • Event

        public event delegate ^ event_name;

For more information about the CLR Data types used in C++/CLI, see:

Classes and Structs (Managed)

Interface class

enum class




Override Specifiers

The following keywords can be used to qualify override behavior for derivation.

Abstract ( ),

New ( ),

Override ( ),

Sealed ( )

New keywords


for each, in





Generics are parameterized types supported by the common language runtime.

A parameterized type is a type that is defined with an unknown type parameter that is specified when the generic is used. For more information, see


Two operators have been added to Visual C++ to support garbage-collected programming.

^ (Handle to Object on Managed Heap)

% (Tracking Reference)

Exception Handling

You can use both structured exception handling (SEH) and C++ exception handling under /clr. Under /clr, you can also handle CLR exceptions. A CLR exception is any exception thrown by a managed type. For more information, see

Type Forwarding

Type forwarding allows you to move a type from one assembly (assembly A) into another assembly (assembly B), such that, it is not necessary to recompile clients that consume assembly A. For more information, see

User-Defined Attributes

You can define a custom attribute by defining a type and making Attribute a base class for the type and optionally applying the AttributeUsageAttribute attribute. For more information, see

Implicit Boxing

The Visual C++ compiler now boxes value types to Object. For more information, see

XML Documentation

In Visual C++, you can add comments to your source code that will be processed to an .xml file. For more information, see

You can learn more about the language features for C++/CLI from the following document: