A static function is a function with the static qualifier applied:
static void foo ( void )
{
/* Blah blah */
}
What it does is restrict visibility of the function to the translation unit in which it's declared. Functions are implicitly declared as extern by default, which means they're visible across translation units. You can compile the following, but it won't link:
/* file1.c */
void foo ( void )
{
}
extern void bar ( void )
{
}
static void baz ( void )
{
}
/* file2.c */
void foo ( void );
void bar ( void );
void baz ( void );
int main ( void )
{
foo(); /* OK: foo is extern by default */
bar(); /* OK: bar is explicitly extern */
baz(); /* Wrong: baz isn't visible in this translation unit */
}
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>Static functions are those functions which do not have the access to
>"this" pointer of the class and it can not be declared as virtual.
You need to learn the difference between C and C++ before resurrecting a three year old thread with completely incorrect and unhelpful information.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401