1. Static variable statics
What is a static variable: triggered from an object-oriented angle, when a data object is required to serve an entire class rather than an object, and there is a need to not break the encapsulation of the class, it requires that the member be hidden inside the class, and when there is a requirement to be invisible, static can be used. The advantages of static variables: 1, save memory. Static variables are stored only one place, but are used by all objects. 2, its value can be updated. 3, can improve time efficiency. Whenever an object updates a static variable once, all objects have access to the updated value.
2. Global variables extern What is a global variable: Also known as an external variable, is a variable defined outside the method. It does not belong to which method, but belongs to the entire source program. The scope is the entire source program. If the global convenience and local variables have the same name, then in the local variable scope, the global variable is masked and does not work. Try not to use global variables when programming. 3, local variables what is a local variable: is defined within the method of the description. Its scope is limited to the method within. 4, instance variables are defined in the class instance variables, can be used within each method. 5, the const variable value is immutable 6, volatile indicates that the variable can be changed at any time from: http://www.devdiv.com/ios_static_extern_-blog-319669-51270.html
iOS summary static variable static, global variable extern, local variable, instance variable