Question
In an object-oriented program, what does declaring an instance variable to be public or private indicate about data coupling? What would be the rationale behind a preference toward declaring instance variables as private?
Step 1
Data coupling occurs when one object directly manipulates or relies on the internal data of another object. This can lead to issues with code maintainability and can make it harder to understand how different parts of a program interact. Show more…
Show all steps
Your feedback will help us improve your experience
Jennifer Stoner and 75 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
If you want to keep classes that instantiate objects of a class from changing their data members, but enable derived classes to change base class data members, the data members in the base class should be defined with a _____________ access modifier. a. private b. public c. internal d. static e. protected
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD