When designing a class, how do you determine what variables should be instance variables and what variables should be local variables?
Added by Alfonso L.
Step 1
This will help you understand what data needs to be associated with each instance of the class. Show more…
Show all steps
Your feedback will help us improve your experience
John Bell and 87 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
Which variables are created when an object is created with the use of the keyword 'new' and destroyed when the object is destroyed? Local variables, instance variables, class variables, static variables.
John B.
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?
If global variables can be used anywhere in the program, why not make all variables global? Justify your answer.
Liam H.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD