Skip to content

Commit e9d63fb

Browse files
author
3836425+corob-msft@users.noreply.github.com
committed
Style and content fixes in cpp language docs
1 parent a728dc9 commit e9d63fb

2 files changed

Lines changed: 29 additions & 30 deletions

File tree

docs/cpp/member-access-operators-dot-and.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
---
2-
description: "Learn more about: Member Access Operators: . and ->"
3-
title: "Member Access Operators: . and ->"
4-
ms.date: "11/04/2016"
2+
description: "Learn more about: Member access operators: '.' and '->'"
3+
title: "Member access operators: '.' and '->'"
4+
ms.date: 12/04/2021
55
f1_keywords: [".", "->"]
66
helpviewer_keywords: ["member access, expressions", "operators [C++], member access", "dot operator (.)", "-> operator", "member access, operators", "postfix operators [C++]", ". operator", "member access"]
77
ms.assetid: f8fc3df9-d728-40c5-b384-276927f5f1b3
88
---
9-
# Member Access Operators: . and ->
9+
# Member access operators: `.` and `->`
1010

1111
## Syntax
1212

13-
```
14-
postfix-expression . name
15-
postfix-expression -> name
16-
```
13+
*`postfix-expression`*:\
14+
&emsp; *`postfix-expression`* **`.`** **`template`**<sub>opt</sub> *`id-expression`*\
15+
&emsp; *`postfix-expression`* **`->`** **`template`**<sub>opt</sub> *`id-expression`*
1716

1817
## Remarks
1918

20-
The member access operators **.** and **->** are used to refer to members of structures, unions, and classes. Member access expressions have the value and type of the selected member.
19+
The member access operators **`.`** and **`->`** are used to refer to members of `struct`, `union`, and `class` types. Member access expressions have the value and type of the selected member.
2120

2221
There are two forms of member access expressions:
2322

24-
1. In the first form, *postfix-expression* represents a value of struct, class, or union type, and *name* names a member of the specified structure, union, or class. The value of the operation is that of *name* and is an l-value if *postfix-expression* is an l-value.
23+
1. In the first form, *`postfix-expression`* represents a value of `struct`, `class`, or `union` type, and *`id-expression`* names a member of the specified `struct`, `union`, or `class`. The value of the operation is that of *`id-expression`* and is an l-value if *`postfix-expression`* is an l-value.
2524

26-
1. In the second form, *postfix-expression* represents a pointer to a structure, union, or class, and *name* names a member of the specified structure, union, or class. The value is that of *name* and is an l-value. The **->** operator dereferences the pointer. Therefore, the expressions `e->member` and `(*e).member` (where *e* represents a pointer) yield identical results (except when the operators **->** or <strong>\*</strong> are overloaded).
25+
1. In the second form, *`postfix-expression`* represents a pointer to a `struct`, `union`, or `class`, and *`id-expression`* names a member of the specified `struct`, `union`, or `class`. The value is that of `id-expression` and is an l-value. The **`->`** operator dereferences the pointer. The expressions `e->member` and `(*(e)).member` (where *`e`* represents a pointer) yield identical results (except when the operators **`->`** or **`*`** are overloaded).
2726

2827
## Example
2928

@@ -63,7 +62,7 @@ int main() {
6362

6463
## See also
6564

66-
[Postfix Expressions](../cpp/postfix-expressions.md)<br/>
67-
[C++ Built-in Operators, Precedence and Associativity](../cpp/cpp-built-in-operators-precedence-and-associativity.md)<br/>
68-
[Classes and Structs](../cpp/classes-and-structs-cpp.md)<br/>
69-
[Structure and Union Members](../c-language/structure-and-union-members.md)
65+
[Postfix expressions](../cpp/postfix-expressions.md)\
66+
[C++ built-in operators, precedence, and associativity](../cpp/cpp-built-in-operators-precedence-and-associativity.md)\
67+
[Classes and Structs](../cpp/classes-and-structs-cpp.md)\
68+
[Structure and union members](../c-language/structure-and-union-members.md)

docs/cpp/pointer-to-member-operators-dot-star-and-star.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
---
2-
description: "Learn more about: Pointer-to-Member Operators: .* and ->*"
3-
title: "Pointer-to-Member Operators: .* and ->*"
4-
ms.date: "11/04/2016"
2+
description: "Learn more about: Pointer-to-member operators: '.*' and '->*'"
3+
title: "Pointer-to-member operators: '.*' and '->*'"
4+
ms.date: 12/04/2021
55
f1_keywords: [".*", "->*"]
66
helpviewer_keywords: ["expressions [C++], pointer", "pointer-to-member operators [C++]", ".* operator", "expressions [C++], operators", "->* operator"]
77
ms.assetid: 2632be3f-1c81-4523-b56c-982a92a68688
88
---
9-
# Pointer-to-Member Operators: .* and -&gt;*
9+
# Pointer-to-member operators: `.*` and `->*`
1010

1111
## Syntax
1212

13-
```
14-
expression .* expression
15-
expression ->* expression
16-
```
13+
*`pm-expression`*:\
14+
&emsp; *`cast-expression`*\
15+
&emsp; *`pm-expression`* **`.*`** *`cast-expression`*\
16+
&emsp; *`pm-expression`* **`->*`** *`cast-expression`*
1717

1818
## Remarks
1919

20-
The pointer-to-member operators, .* and ->\*, return the value of a specific class member for the object specified on the left side of the expression. The right side must specify a member of the class. The following example shows how to use these operators:
20+
The pointer-to-member operators **`.*`** and **`->*`** return the value of a specific class member for the object specified on the left side of the expression. The right side must specify a member of the class. The following example shows how to use these operators:
2121

2222
```cpp
2323
// expre_Expressions_with_Pointer_Member_Operators.cpp
@@ -68,13 +68,13 @@ m_func1
6868

6969
In the preceding example, a pointer to a member, `pmfn`, is used to invoke the member function `m_func1`. Another pointer to a member, `pmd`, is used to access the `m_num` member.
7070

71-
The binary operator .* combines its first operand, which must be an object of class type, with its second operand, which must be a pointer-to-member type.
71+
The binary operator **`.*`** combines its first operand, which must be an object of class type, with its second operand, which must be a pointer-to-member type.
7272

73-
The binary operator ->* combines its first operand, which must be a pointer to an object of class type, with its second operand, which must be a pointer-to-member type.
73+
The binary operator **`->*`** combines its first operand, which must be a pointer to an object of class type, with its second operand, which must be a pointer-to-member type.
7474

75-
In an expression containing the .* operator, the first operand must be of the class type of, and be accessible to, the pointer to member specified in the second operand or of an accessible type unambiguously derived from and accessible to that class.
75+
In an expression containing the **`.*`** operator, the first operand must be of the class type of, and be accessible to, the pointer to member specified in the second operand or of an accessible type unambiguously derived from and accessible to that class.
7676

77-
In an expression containing the ->* operator, the first operand must be of the type "pointer to the class type" of the type specified in the second operand, or it must be of a type unambiguously derived from that class.
77+
In an expression containing the **`->*`** operator, the first operand must be of the type "pointer to the class type" of the type specified in the second operand, or it must be of a type unambiguously derived from that class.
7878

7979
## Example
8080

@@ -116,11 +116,11 @@ int main() {
116116
}
117117
```
118118
119-
The result of the .* or ->\* pointer-to-member operators is an object or function of the type specified in the declaration of the pointer to member. So, in the preceding example, the result of the expression `ADerived.*pmfnFunc1()` is a pointer to a function that returns void. This result is an l-value if the second operand is an l-value.
119+
The result of the **`.*`** or **`->*`** pointer-to-member operators is an object or function of the type specified in the declaration of the pointer to member. So, in the preceding example, the result of the expression `ADerived.*pmfnFunc1()` is a pointer to a function that returns void. This result is an l-value if the second operand is an l-value.
120120
121121
> [!NOTE]
122122
> If the result of one of the pointer-to-member operators is a function, then the result can be used only as an operand to the function call operator.
123123
124124
## See also
125125
126-
[C++ Built-in Operators, Precedence and Associativity](../cpp/cpp-built-in-operators-precedence-and-associativity.md)
126+
[C++ built-in operators, precedence, and associativity](../cpp/cpp-built-in-operators-precedence-and-associativity.md)

0 commit comments

Comments
 (0)