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.
ref class RefClass{...};
ref struct RefClass{...};
value class ValClass{...};
value struct ValClass{...};
interface class IType{...};
interface struct IType{...};
enum class Day{...};
enum struct Day{...};
property int Property_Block
{
int get();
void set(int value)
MyInt = value;
}
public delegate void MyDel(…);
public event delegate ^ event_name;
For more information about the CLR Data types used in C++/CLI, see:
Classes and Structs (Managed)
http://msdn.microsoft.com/en-us/library/6w96b5h7.aspx
Interface class
http://msdn.microsoft.com/en-us/library/737cydt1.aspx
enum class
http://msdn.microsoft.com/en-us/library/a6cskb49.aspx
Properties
http://msdn.microsoft.com/en-us/library/es7h5kch.aspx
Delegates:
http://msdn.microsoft.com/en-us/library/3z2x4f55.aspx
Events:
http://msdn.microsoft.com/en-us/library/4b612y2s.aspx
The following keywords can be used to qualify override behavior for derivation.
Abstract (http://msdn.microsoft.com/en-us/library/b0z6b513.aspx ),
New (http://msdn.microsoft.com/en-us/library/86hbff6c.aspx ),
Override (http://msdn.microsoft.com/en-us/library/41w3sh1c.aspx ),
Sealed (http://msdn.microsoft.com/en-us/library/0w2w91tf.aspx )
gcnew
http://msdn.microsoft.com/en-us/library/te3ecsc8%28v=VS.100%29.aspx
for each, in
http://msdn.microsoft.com/en-us/library/ms177202%28v=VS.100%29.aspx
initonly
http://msdn.microsoft.com/en-us/library/4d8xah36.aspx
literal
http://msdn.microsoft.com/en-us/library/5yzft952.aspx
nullptr
http://blogs.msdn.com/msdnforum/archive/2010/03.aspx
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
http://msdn.microsoft.com/en-us/library/8z2kbc1y.aspx
Two operators have been added to Visual C++ to support garbage-collected programming.
^ (Handle to Object on Managed Heap)
http://msdn.microsoft.com/en-us/library/yk97tc08.aspx
% (Tracking Reference)
http://msdn.microsoft.com/en-us/library/8903062a.aspx
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
http://msdn.microsoft.com/en-us/library/633chdda.aspx
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
http://msdn.microsoft.com/en-us/library/ms177220%28v=VS.100%29.aspx
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
http://msdn.microsoft.com/en-us/library/yd21828z%28v=VS.100%29.aspx
The Visual C++ compiler now boxes value types to Object. For more information, see
http://msdn.microsoft.com/en-us/library/c53ss7ze%28v=VS.100%29.aspx
In Visual C++, you can add comments to your source code that will be processed to an .xml file. For more information, see
http://msdn.microsoft.com/en-us/library/ms177226%28v=VS.100%29.aspx
You can learn more about the language features for C++/CLI from the following document:
http://msdn.microsoft.com/en-us/library/xey702bw.aspx