Question 1
Back to Exercise
Which statement best describes encapsulation?
- A Deriving a class from another
- B Bundling data with the functions that operate on it and hiding the data so the object controls its own state Correct
- C Using one name for many functions
- D Allocating objects dynamically
Correct Answer: Option B
Data hiding (private members) is the mechanism; the goal is that only the object's own functions can change its state.
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!