c++ - Static function access in other files -


Is there any chance that static functions can be assessed outside the filing?

It depends on what you mean by "access" Can not be called by name because it is stable in a separate file, but you have a function pointer.

  $ cat f1.c / * static * / static int number (zero) {return 42; } / * "Global" indicator * / integer (* pf) (zero); Zero start (zero) {pf = number; } $ Cat f2.c # include & lt; Stdio.h & gt; Extra int (* PF) (zero); External zero start (zero); Int main (zero) {start (); Printf ("% d \ n", PF ()); Return 0; } $ Gcc -ansi -pedantic -W-wall f1.c f2.c $ ./a.out42  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -