0

why every object has it’s own personal copy of an instance variable?

I am new to programming so please bare my questions even if it is stupid one :)

4th Mar 2017, 11:30 AM
Deadpool
Deadpool - avatar
2 Antworten
+ 2
That's what makes object oriented programming so great ;) the fact that you are able to create multiple objects, or instances, of the same class where each instance will have their own value of variable members (with the exception of static members). It's just how the language is, and as you become more accustomed to the concept you'll realise how useful the feature is in every aspect of programming, from games to general purpose applications.
4th Mar 2017, 2:35 PM
Cohen Creber
Cohen Creber - avatar
0
Think about persons. Each person has a name and age. They all have their own name and age. That's what instance variables are.
4th Mar 2017, 11:11 PM
1of3
1of3 - avatar