You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/windows/generic-classes-cpp-cli.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ A generic class is declared using the following form:
16
16
17
17
## Syntax
18
18
19
-
```
19
+
```cpp
20
20
[attributes]
21
21
generic <class-key type-parameter-identifier(s)>
22
22
[constraint-clauses]
@@ -30,7 +30,7 @@ class-body
30
30
## Remarks
31
31
In the above syntax, the following terms are used:
32
32
33
-
`attributes` (optional)
33
+
*attributes* (optional)
34
34
Additional declarative information. For more information on attributes and attribute classes, see Attributes.
35
35
36
36
*class-key*
@@ -414,7 +414,7 @@ ref struct Outer {
414
414
};
415
415
```
416
416
417
-
The type Outer\<int>::Inner is not the same as the type Outer\<double>::Inner.
417
+
The type `Outer<int>::Inner` is not the same as the type `Outer<double>::Inner`.
418
418
419
419
As with generic methods in generic classes, additional type parameters can be defined for the nested type. If you use the same type parameter names in the inner and outer class, the inner type parameter will hide the outer type parameter.
420
420
@@ -434,7 +434,7 @@ ref class Outer {
434
434
435
435
Since there is no way to refer to the outer type parameter, the compiler will produce a warning in this situation.
436
436
437
-
When constructed nested generic types are named, the type parameter for the outer type is not included in the type parameter list for the inner type, even though the inner type is implicitly parameterized by the outer type's type parameter. In the above case, a name of a constructed type would be Outer\<int>::Inner\<string>.
437
+
When constructed nested generic types are named, the type parameter for the outer type is not included in the type parameter list for the inner type, even though the inner type is implicitly parameterized by the outer type's type parameter. In the above case, a name of a constructed type would be `Outer<int>::Inner<string>`.
438
438
439
439
The following example demonstrates building and reading a linked list using nested types in generic classes.
440
440
@@ -533,7 +533,7 @@ Reading nodes:
533
533
534
534
- Properties, events, indexers and operators can use the type parameters of the enclosing generic class as return values, parameters, or local variables, such as when `ItemType` is a type parameter of a class:
The following code sample demonstrates a generic function.
85
84
@@ -114,8 +113,6 @@ int main() {
114
113
}
115
114
```
116
115
117
-
**Example**
118
-
119
116
Generic functions can be overloaded based on signature or arity, the number of type parameters on a function. Also, generic functions can be overloaded with non-generic functions of the same name, as long as the functions differ in some type parameters. For example, the following functions can be overloaded:
120
117
121
118
```cpp
@@ -132,8 +129,6 @@ ref struct MyClass {
132
129
};
133
130
```
134
131
135
-
**Example**
136
-
137
132
The following example uses a generic function to find the first element in an array. It declares `MyClass`, which inherits from the base class `MyBaseClass`. `MyClass` contains a generic function, `MyFunction`, which calls another generic function, `MyBaseClassFunction`, within the base class. In `main`, the generic function, `MyFunction`, is called using different type arguments.
138
133
139
134
```cpp
@@ -170,8 +165,6 @@ int main() {
170
165
}
171
166
```
172
167
173
-
**Output**
174
-
175
168
```Output
176
169
My function returned an int: 2003
177
170
My function returned a string: Hello generic functions!
Copy file name to clipboardExpand all lines: docs/windows/generics-and-templates-visual-cpp.md
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ Generics and templates are both language features that provide support for param
39
39
40
40
## Combining Templates and Generics
41
41
42
-
-The basic difference in generics has implications for building applications that combine templates and generics. For example, suppose you have a template class that you want to create a generic wrapper for to expose that template to other languages as a generic. You cannot have the generic take a type parameter that it then passes though to the template, since the template needs to have that type parameter at compile time, but the generic won't resolve the type parameter until runtime. Nesting a template inside a generic won't work either because there's no way to expand the templates at compile time for arbitrary generic types that could be instantiated at runtime.
42
+
The basic difference in generics has implications for building applications that combine templates and generics. For example, suppose you have a template class that you want to create a generic wrapper for to expose that template to other languages as a generic. You cannot have the generic take a type parameter that it then passes though to the template, since the template needs to have that type parameter at compile time, but the generic won't resolve the type parameter until runtime. Nesting a template inside a generic won't work either because there's no way to expand the templates at compile time for arbitrary generic types that could be instantiated at runtime.
Generics are parameterized types and methods. In this section, find out which generic features are supported by both the Windows Runtime and the common language runtime, and which are supported by only the common language runtime. Also, find out how to author your own generic methods and types in Visual C++, and how to use generic types authored in a .NET Framework language in Visual C++. Finally, this section provides a comparison of generics and C++ templates.
17
17
18
18
## In This Section
19
-
**Supported by the Windows Runtime and the Common Language Runtime**
19
+
### Supported by the Windows Runtime and the Common Language Runtime
20
20
21
21
[Overview of Generics in Visual C++](../windows/overview-of-generics-in-visual-cpp.md)
22
22
Information about generics are, the motivation for the language feature, definitions of terms used to describe generics, and information about the use of reference types and value types as type parameters for generics.
@@ -36,7 +36,7 @@ Generics are parameterized types and methods. In this section, find out which ge
36
36
[Generics and Templates (Visual C++)](../windows/generics-and-templates-visual-cpp.md)
37
37
A comparison of generics and templates, when to use each, and how to combine them usefully.
Copy file name to clipboardExpand all lines: docs/windows/grouping-radio-buttons-on-a-dialog-box.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ ms.author: "mblome"
13
13
ms.workload: ["cplusplus", "uwp"]
14
14
---
15
15
# Grouping Radio Buttons on a Dialog Box
16
-
When you add radio buttons to a dialog box, treat them as a group by setting a Group property in the Properties window for the first button in the group. A control ID for that radio button then appears in the [Add Member Variable Wizard](../ide/add-member-variable-wizard.md), allowing you to add a member variable for the group of radio buttons.
16
+
When you add radio buttons to a dialog box, treat them as a group by setting a **Group** property in the **Properties** window for the first button in the group. A control ID for that radio button then appears in the [Add Member Variable Wizard](../ide/add-member-variable-wizard.md), allowing you to add a member variable for the group of radio buttons.
17
17
18
18
You can have more than one group of radio buttons on a dialog box, and each group should be added using the following procedure.
19
19
@@ -28,7 +28,7 @@ When you add radio buttons to a dialog box, treat them as a group by setting a G
28
28
Changing the **Group** property to **True** adds the WS_GROUP style to the button's entry in the dialog object of the resource script and ensures that a user can only select one radio button at a time in the button group (when the user clicks one radio button, the others in the group are cleared).
29
29
30
30
> [!NOTE]
31
-
> Only the first radio button in the group should have the **Group** property set to **True**. If you have additional controls that are not part of the button group, set the **Group** property of the first control *that is outside the group* to **True** as well. You can quickly identify the first control outside of the group by pressing CTRL+D to view the tab order.
31
+
> Only the first radio button in the group should have the **Group** property set to **True**. If you have additional controls that are not part of the button group, set the **Group** property of the first control *that is outside the group* to **True** as well. You can quickly identify the first control outside of the group by pressing **Ctrl**+**D** to view the tab order.
32
32
33
33
### To add a member variable for the radio button group
34
34
@@ -40,14 +40,13 @@ When you add radio buttons to a dialog box, treat them as a group by setting a G
40
40
41
41
4. In the **Variable name** box, type a name for the new member variable.
42
42
43
-
5. In the **Variable type** list box, select **int** or type **int**.
43
+
5. In the **Variable type** list box, select **int** or type `int`.
44
44
45
-
6. You can now modify your code to specify which radio button should appear selected. For example, m_radioBox1 = 0; selects the first radio button in the group.
45
+
6. You can now modify your code to specify which radio button should appear selected. For example, `m_radioBox1 = 0;` selects the first radio button in the group.
46
46
47
47
For information on adding resources to managed projects, please see [Resources in Desktop Apps](/dotnet/framework/resources/index) in the *.NET Framework Developer's Guide*. For information on manually adding resource files to managed projects, accessing resources, displaying static resources, and assigning resource strings to properties, see [Creating Resource Files for Desktop Apps](/dotnet/framework/resources/creating-resource-files-for-desktop-apps). For information on globalization and localization of resources in managed apps, see [Globalizing and Localizing .NET Framework Applications](/dotnet/standard/globalization-localization/index).
0 commit comments