Question 13
Back to Exercise
A class has a const int id_; member. What happens to its copy assignment operator?
- A It works normally
- B The implicit copy assignment is deleted, because id_ cannot be assigned Correct
- C It assigns only non-const members
- D It throws an exception
Correct Answer: Option B
Objects can still be copy-constructed but not assigned – a trade-off to consider when using const members for immutability.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!