Properties are class members that hold data associated with an object while exposing controlled access-typically through getter and setter methods. This supports encapsulation by hiding an object's internal state and allowing external code to read or modify that state only through a defined interface. The distractor that talks about functions describes methods (behavior, not stored state). The option mentioning repetitive execution refers to loops, a control-flow construct unrelated to object properties. The choice about generic placeholders describes variables, which are broader in scope and not inherently tied to an object's encapsulated state.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What are getters and setters in object-oriented programming?
Open an interactive chat with Bash
What is encapsulation in object-oriented programming?
Open an interactive chat with Bash
Why is it important to encapsulate data in programming?