Question: The canonical form of the assignment operator is: Class& Class::operator= (const Class& rhs) { } Class temp (rhs); swap (temp); return this; (a) What
The canonical form of the assignment operator is: Class& Class::operator= (const Class& rhs) { } Class temp (rhs); swap (temp); return this; (a) What is meant by an atomic operation? (b) Why does this form of the assignment operator guarantee atomic assignment? (2 marks) marks) marks) (c) What is the purpose of returning this? (d) Rewrite the canonical form given above so that it works in an identical fashion but has one line less of code. (3 marks)
Step by Step Solution
3.55 Rating (152 Votes )
There are 3 Steps involved in it
The image shows a text question discussing a piece of code that represents the assignment operator for a class in C programming The code and subsequen... View full answer
Get step-by-step solutions from verified subject matter experts
