Why is assigning "size" that way considered WRONG?
posted 6 years ago
It is not "considered" wrong, it is incorrect. In the body of the setSize method, "size" refers to the parameter, not to the instance variable. So what that assignment does is assign the parameter to itself - in other words, it does nothing. Especially the value of the instance variable of the same name is not changed.
John de Michele