C++ COMPONENT EXTENSIONS (C++/CX)
All data that you pass to, or receive from, the WinRT must be WinRT objects. Data of any of the fundamental C++ types will be converted to the equivalent WinRT type automatically, so you can always use C++ fundamental types in your Windows 8 apps. The WinRT types corresponding to C++ fundamental types are referred to as value types because they have pass-by-value semantics. You cannot pass objects of standard C++ class types to WinRT components. You must use WinRT object types. These are referred to as ref class or ref struct types, which are the WinRT equivalents of the standard C++ class and struct types. C++/CX provides additional language syntax for defining WinRT types and for working with WinRT objects.
C++/CX Namespaces
There are three C++/CX namespaces that contain things you should know about. These are the default namespaces that contain the WinRT types that correspond to the fundamental types in standard C++: the Platform namespace, the Platform::Collections namespace, and the Windows::Foundation::Collections namespace. You don’t generally need to concern yourself with defining variables of the types in the default namespace. You can just use the C++ fundamental types in your code and they will be automatically converted to the corresponding value class type from the default namespace.
The Platform namespace contains, among others, the following built-in WinRT types:
TYPE | USE |
Object | The base class for all WinRT types so it can ... |
Get Ivor Horton's Beginning Visual C++ 2012 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.