Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What are the static members of a class in C language? How to define static members? What are the functions of static data members and static member functions?
What are the static members of a class in C language? How to define static members? What are the functions of static data members and static member functions?
Static member function is a member function of a class, which does not belong to any object applied by this class, but is a function shared by all members of this class.

Static member variables are decorated with static.

For example, there are 10 people in your class (for example, 10, the object of the higher class). The PE teacher gives you a basketball (static membership function), and each of you brings a basketball (non-static membership function). You are all stingy, so you can only shoot your own balls. If you play 5-5, you can only use that static basketball (one each). Therefore, I can say that basketball is a member of Class One, Senior One. So that is to say: the static member function is a class member function (because it can't be played in Class One or Two), but the basketball will eventually be returned to the teacher, and no private person can possess it. I hope you can understand that in fact, in the machine structure, the memory of static members is unique, which is opened when you declare outside the class, while the space allocation of non-static functions is created when you instantiate the object.

Give you another link:/444789192/blog/item/486cebc63fe2dbd5d0060e9.html.