Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 1.18 KB

template-ref-classes-c-cx.md

File metadata and controls

21 lines (15 loc) · 1.18 KB
description title ms.date ms.assetid
Learn more about: Template ref classes (C++/CX)
Template ref classes (C++/CX)
01/22/2017
a24d5f45-8dbb-4540-958f-c76c90d8ed93

Template ref classes (C++/CX)

C++ templates are not published to metadata and therefore cannot have public or protected accessibility in your program. You can, of course, use standard C++ templates internally in your program. In addition, you can define a private ref class as a template and you can declare an explicitly specialized template ref class as a private member in a public ref class.

Authoring ref class templates

The following example shows how to declare a private ref class as a template, and also how to declare a standard C++ template and how declare them both as members in a public ref class. Note that the standard C++ template can be specialized by a Windows Runtime type, in this case a Platform::String^.

[!code-cppcx_templates#01]

See also

Type System (C++/CX)
C++/CX Language Reference
Namespaces Reference