General information
Category:
Object Oriented Programming
You have not actually overridden the value of mynumber in the class.
If I understand your question, you are unsure why the o2.mynumber value returns 1234 even though you have created the o1 object an set the o1.mynumber property to 5678? You need to understand that an object is an instance of a class. You cannot change the value of class properties at runtime you can only change the calue of object properties so the o1 object is quite independent from the o2 object and nothing that you do to o1 will have any influence over o2 in the example you have provided.
does that explanation make sense?
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only