Anonymous
Asked in
Cars &Transportation
·
2 weeks ago
What is difference between instance and local variable?
Contents
- What are the differences between local static and instance variables?
- What is difference between instance variable and global variable?
What are the differences between local static and instance variables?
Instance variables are created when an object is created with the use of the keyword 'new' and destroyed when the object is destroyed. Static variables are created when the program starts and destroyed when the program stops. Instance variables can be accessed directly by calling the variable name inside the class.
What is difference between instance variable and global variable?
gx is a global variable accessible anywhere in the module, ix is an instance variable that could have a unique value for each instance of the object. When referenced inside of the object definition you would refer to ix with the prefix self , and when outside the object with a prefix of the object reference.
Related Questions
Relevance
-
Anonymous2 weeks ago
Expert answer2 weeks ago -
Anonymous2 weeks ago
Expert answer2 weeks ago -
Anonymous2 weeks ago
Expert answer2 weeks ago -
Anonymous2 weeks ago
Expert answer2 weeks ago -
Anonymous2 weeks ago
Expert answer2 weeks ago -
Anonymous2 weeks ago
Expert answer2 weeks ago
Write us your question, the answer will be received in 24 hours