Can we access static functions defined in one file to another file?
In the code below, I cannot call the static method fun(). Why can't I and is there another way to access it?
static void fun();// In abc.h
static void fun(){cout<<"Hello."<<endl;}
//xyz.cpp
#include "abc.h"
void main()
{
fun();// Why I am not able to call this static method? Is there any other way to
//Access this static function?
}
fun()defined in header file?mainto returnint). You can access functions with internal linkage from different files so long as all those files are#included into the same translation unit.