Skip to content

Commit afe76a3

Browse files
Merge pull request #1 from TylerMSFT/RAS-cpp-US1921538-1
Ras cpp us1921538 1
2 parents 7c8315f + 93aca6d commit afe76a3

File tree

3 files changed

+21
-25
lines changed

3 files changed

+21
-25
lines changed
Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,58 @@
11
---
2-
description: "Learn more about: Add a method to an interface in a Visual C++ project"
2+
description: "Learn more about: Add a method to an interface in a Microsoft Visual Studio C++ project"
33
title: "Add a method"
4-
ms.date: "03/21/2022"
4+
ms.date: "03/28/2022"
55
f1_keywords: ["vc.codewiz.method.overview", "vc.codewiz.method.idlattrib"]
66
helpviewer_keywords: ["add method wizard [C++]", "methods [C++], adding", "methods [C++], adding using wizards", "IDL attributes, add method wizard"]
77
ms.custom: devdivchpfy22
88
---
99
# Add a method
1010

11-
You can use the [add method wizard](#add-method-wizard) to add a method to an interface in your project. In your project, add interface and follow the given steps to get the **Add method** wizard. If the project contains a class associated with the interface, the wizard modifies the class, too.
11+
Use the [add method wizard](#add-method-wizard-dialog-box) to add a method to an interface in your project. If the project contains a class associated with the interface, the wizard also adds the method to the class.
1212

13-
**To add a method to your object:**
13+
**Add a method to your interface:**
1414

15-
1. In **Class View**, expand the project node to display the interface to which you want to add the method.
15+
1. From the Visual Studio main menu, choose **View** > **Class view**. In the **Class View** pane, expand the project node to display the interface you want to add the method to.
1616

1717
> [!NOTE]
18-
> You can also add methods to dispinterfaces, which, unless the project is attributed, are located under the library node.
18+
> You can also add methods to dispinterfaces. Unless the project is attributed, dispinterfaces are located under the library node.
1919
2020
1. Right-click the name of the interface.
2121

22-
1. On the shortcut menu, choose **Add**, and then choose **Add Method**.
22+
1. On the shortcut menu, choose **Add** > **Add Method**.
2323

24-
1. In the **Add Method** wizard, provide the information to create the method.
24+
1. In the **Add Method** wizard dialog box, provide the information to create the method as described in the next section.
2525

2626
1. Select **OK** to add the method.
2727

28-
## Add method wizard
28+
## Add method wizard dialog box
2929

30-
Use this wizard to add a method to an interface.
30+
Add a method to an interface by using the add method wizard dialog box:
3131

32-
:::image type="content" source="../ide/media/add-method-wizard.png" alt-text="Screenshot of Add method wizard":::
32+
:::image type="content" source="../ide/media/add-method-wizard.png" alt-text="Screenshot of Add method wizard with the method name field set to aMethod and the return type set to HRESULT. In the Parameters section, two parameters are defined: int x, and bool clip":::
3333

3434
### Names
3535

3636
- **Method name**
3737

38-
Sets the method name. Provide your own method name.
38+
Provide the method name.
3939

4040
- **Return type**
4141

42-
The data type returned by the method. Provide your own return type or select from the list.
42+
Type the return type or select it from the drop-down list.
4343

44-
- **Parameter type**
45-
46-
Sets the data type of the parameter. You can type it with parameter name.
47-
48-
- **Parameter name**
44+
- **Parameters**
4945

50-
Sets the name of a parameter. Select **+** to add the parameter to the list of parameters.
46+
Displays the method's parameters, modifiers, and types. The wizard updates the **Parameters** list as you add parameters.
5147

52-
- **+**
48+
**+**
5349

54-
Adds the parameter to the list of parameters. Specify the parameter name and its type in **Parameters**.
50+
Add a parameter. In **Parameters**, type the parameter type, name, and any modifiers. For example, `int x`, and choose **OK**.
5551

5652
- **x**
5753

58-
Removes the selected parameter from the **Parameters** list.
54+
Remove the selected parameter from the **Parameters** list.
5955

60-
- **Parameters**
56+
- **Pencil icon**
6157

62-
Displays all of the methods parameters, modifiers, and types. The wizard updates the **Parameters** list as you add parameters.
58+
Edit the selected parameter.

docs/ide/media/add-method-wizard.png

-6.29 KB
Loading

docs/ide/writing-and-refactoring-code-cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Edit and refactor C++ code in Visual Studio"T
2+
title: "Edit and refactor C++ code in Visual Studio"
33
description: "Use the C++ code editor in Visual Studio to format, navigate, understand and refactor your code."
44
ms.date: "05/31/2019"
55
ms.assetid: 56ffb9e9-514f-41f4-a3cf-fd9ce2daf3b6

0 commit comments

Comments
 (0)