Static is a function that is added to a non-class member function. Because the static version of the class member function has other purposes), it is equivalent to the role of anonymous space-Information Hiding. Translation into the vernacular version is that it can only be seen in the current compilation unit, but not in other compilation units. (What is a compilation unit? Is a CPP file that contains the header file)
See the following two sections of code:
Function. cpp:
Static void function (Int & A) {A ++ ;}
Main. cpp:
# Include <iostream> extern void function (Int &); int main () {int A = 0; function (a); STD: cout <A <STD :: endl; return 0 ;}
Compiler error: Main. OBJ: Error lnk2019: external symbol that cannot be parsed "Void _ cdecl function (Int &)"
(Subject: extern void function (INT) and extern void function (Int &) are not the same function declaration! Note)