Question 5
Back to Exercise
Can a member function of class Wallet read the private members of a different Wallet object passed to it?
- A No, only of *this
- B Yes – access control in C++ is per class, not per object Correct
- C Only if the other object is const
- D Only through getters
Correct Answer: Option B
That is how copy constructors and comparison operators read the other object's private data.
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!