Home  >  Article  >  Backend Development  >  What are the characteristics of static member functions?

What are the characteristics of static member functions?

尚
Original
2020-03-07 15:47:344774browse

What are the characteristics of static member functions?

Characteristics of static member functions:

1. They are shared by all objects of the class and do not belong to a certain object. It can be called directly through the class name::.

2. Compared with ordinary member functions, there is no hidden this pointer as a parameter. This can be used to encapsulate thread classes.

3. Static member functions can only access static member variables.

4. Static local variables are saved in the global data area instead of on the stack. Each value is kept until the next call until a new value is assigned next time.

The above is the detailed content of What are the characteristics of static member functions?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn