Static variables:
A static variable is like a member variable, which is characterized by a static front.
The normal variable will have multiple copies, it exists in each object, but there is only one copy of the static variable, it belongs to the class.
Methods for calling static variables:
1. Class name. Variable name
Customer.name = "South Central University"
2. Name of the object. Class Name
A1.name = "South Central University" the second more common
Normal variable static variable
Class name. Access can not be
The object name. Access can be
Static member functions:
Add static before the member function
1. A static member function can be a class name. member variable and object name. static member variable.
2. Static member functions can only invoke static member variables and cannot access ordinary variables.
The purpose of the invention of a static function: to manipulate static variables, to perform some content unrelated to a particular object
Static variable normal variable
Static functions can not be
Normal functions can be
——————————————————————————————————————————-
static functions and static variables for Java