adding line breaks

This commit is contained in:
Jidong Xiao
2023-09-26 12:10:04 -04:00
parent 587113de44
commit b4a5e201ee

View File

@@ -181,11 +181,11 @@ v1.operator=(v2.operator=(v3));
``` ```
- Therefore, the value of the assignment operator (v2 = v3) must be suitable for input to a second assignment - Therefore, the value of the assignment operator (v2 = v3) must be suitable for input to a second assignment
operator. This in turn means the result of an assignment operator ought to be a reference to an object. operator. This in turn means the result of an assignment operator ought to be a reference to an object.
- The implementation of an assignment operator usually takes on the same form for every class: - The implementation of an assignment operator usually takes on the same form for every class:
Do no real work if there is a self-assignment. Do no real work if there is a self-assignment.
Otherwise, destroy the contents of the current object then copy the passed object, just as done by the Otherwise, destroy the contents of the current object then copy the passed object, just as done by the
copy constructor. In fact, it often makes sense to write a private helper function used by both the copy copy constructor. In fact, it often makes sense to write a private helper function used by both the copy
constructor and the assignment operator. constructor and the assignment operator.
Return a reference to the (copied) current object, using the this pointer. Return a reference to the (copied) current object, using the this pointer.
**Note**: In C++, the assignment operator is used for assignment after an object has already been created. And because of that, the following two code snippets behave differently. **Note**: In C++, the assignment operator is used for assignment after an object has already been created. And because of that, the following two code snippets behave differently.