Q. Which of the following is the correct way to define a move assignment operator in C++?

  • (A) MyClass& operator=(MyClass&& other) { }
  • (B) MyClass& operator=(MyClass& other) { }
  • (C) Both A and B
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (A) MyClass& operator=(MyClass&& other) { }
Explanation: The correct way to define a move assignment operator is 'MyClass& operator=(MyClass&& other) { }'.
Explanation by: Ranjeet
The correct way to define a move assignment operator is 'MyClass& operator=(MyClass&& other) { }'.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
113
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Ranjeet
Publisher
πŸ“ˆ
87%
Success Rate