Static vs Instance Variables: Difference?
问题 What is the difference between a static and instance variable. The following sentence is what I cant get: In certain cases, only one copy of a particular variable should be shared by all objects of a class- here a static variable is used. A static variable represents class wide info.All objects of a class share the same data. I thought that instance vars were used class wide whereas static variables only had scope within their own methods? 回答1: In the context of class attributes, static has a