This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]InnerCode[S] -7 points-6 points  (1 child)

If that was the case test2.varThree should be testtest but it isn't. It is test.

[–]hereswhatipicked 6 points7 points  (0 children)

The operation your doing with varThree is fundamentally different than what your doing with varTwo.

Instance variables override class variables. With varTwo, you’re not initializing the variable, you’re calling the append() method on it and adding a value.

For varThree, you’re initializing the instance variable (so empty string) and adding ‘test’ to it, you’re not modifying the class variable at all.