Question 2
Back to Exercise
How is data hiding achieved in C++?
- A With namespaces
- B By declaring data members private (or protected) Correct
- C With the static keyword
- D By using pointers
Correct Answer: Option B
Code outside the class – except friends – cannot name private members.
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!