* Jianli Shen:
New c++:-)
When look through code, I always find lot of funtions are
declared as (in .h):
static void function1();
when implementing,(in .cpp), just
void function1(){
}
Perhaps that description is not quite accurate, because such code is
meaningless.
It will be nice to explain the art of usage for static member, extern member
(no extern function)etc.
A member is something that's part of a class.
Your 'function1' example is not a member function.
The word 'static' means one thing for a free-standing function, and something
else for a member function.
For a free-standing function 'static' denotes internal linkage, i.e. a
function that is not visible outside this compilation unit. That usage is
deprecated. The new feature replacing that usage is the anonymous namespace.
The word 'extern' denotes the opposite of 'static' in this context. Etc. I
don't know, there's nothing in between internal and external linkage.
For a member function 'static' denotes a member that conceptually is
free-standing, but is within the scope of the class. Thus, a static member
function can be called without having an instance of the class. And it's got
access to static data members in the class.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?