1: //storage_linkage_aux3.cpp 2: //Goes with storage_linkage_main3.cpp. Compile the two files 3: //separately and link the object files to produce an executable. 4: //The use of the keyword "static" applied to the definition of 5: //the function SayHi() in the global namespace of this file 6: //restricts the visibility of the function to this file. 8: #include <iostream> 9: using namespace std; 11: static void SayHi() 12: { 13: cout << "\nHi from the auxiliary file!"; 14: } 16: void DisplayGreeting() 17: { 18: SayHi(); 19: cout << "\nHow the heck are you?"; 20: } 22: /* 23: Question: 24: What will the effect be if the keyword static is removed 25: from the definition of the function SayHi() and the function 26: is instead placed in the anonymous namespace for this file? 28: Answer: 29: No effect. In fact, this is the recommended approach to use 30: for limiting visiblity to a file, rather than using "static". 31: */