Question: When designing a class, how do you determine what variables should be instance variables and what variables should be local variables? When writing a class,
When designing a class, how do you determine what variables should be instance variables and what variables should be local variables?
When writing a class, all variables in the methods should be instance variables.
Any variable name used in two different methods must be an instance variable, but if it is only used in one method it should be a local variable.
Only variables that consist of data for the object the class is modeling should be instance variables.
None of the above
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
