tmp/tmpk5ms0jfy/{from.md → to.md}
RENAMED
|
@@ -1,22 +1,28 @@
|
|
| 1 |
-
###
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
user ([[class.copy]]), a base class assignment operator is always
|
| 7 |
-
hidden by the copy assignment operator of the derived class.
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
[*Note
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
[*Example 1*:
|
| 20 |
|
| 21 |
``` cpp
|
| 22 |
struct B {
|
|
|
|
| 1 |
+
#### Simple assignment <a id="over.ass">[[over.ass]]</a>
|
| 2 |
|
| 3 |
+
A *simple assignment operator function* is a binary operator function
|
| 4 |
+
named `operator=`. A simple assignment operator function shall be a
|
| 5 |
+
non-static member function.
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
[*Note 1*: Because only standard conversion sequences are considered
|
| 8 |
+
when converting to the left operand of an assignment operation
|
| 9 |
+
[[over.best.ics]], an expression `x = y` with a subexpression x of class
|
| 10 |
+
type is always interpreted as `x.operator=(y)`. — *end note*]
|
| 11 |
|
| 12 |
+
[*Note 2*: Since a copy assignment operator is implicitly declared for
|
| 13 |
+
a class if not declared by the user [[class.copy.assign]], a base class
|
| 14 |
+
assignment operator function is always hidden by the copy assignment
|
| 15 |
+
operator function of the derived class. — *end note*]
|
| 16 |
|
| 17 |
+
[*Note 3*:
|
| 18 |
+
|
| 19 |
+
Any assignment operator function, even the copy and move assignment
|
| 20 |
+
operators, can be virtual. For a derived class `D` with a base class `B`
|
| 21 |
+
for which a virtual copy/move assignment has been declared, the
|
| 22 |
+
copy/move assignment operator in `D` does not override `B`’s virtual
|
| 23 |
+
copy/move assignment operator.
|
| 24 |
|
| 25 |
[*Example 1*:
|
| 26 |
|
| 27 |
``` cpp
|
| 28 |
struct B {
|