LearnFrenzy
Sign in Take a free test

Encapsulation · Encapsulation MCQ · Question 11

When is mutable appropriate? Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 11 Back to Exercise

Which member is a good candidate for mutable?

  • A The account balance
  • B A cache of a computed value or a call counter that does not change the object's observable value Correct
  • C The object's ID
  • D A const data member
Correct Answer: Option B

mutable members may change inside const functions; using it for real state would make const meaningless.

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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links