To me, the use of the keyword static
in C and languages like C# and Java are "false friends" like "to become" in English and "bekommen" in German (= "to get" in English), because they mean different things.
In C static
means, that the function or variable is only accessible via functions inside the same source file, comparable to private
functions and members in C++, Java and C#.
In C++, Java and C# static
means, that the methods are not members of a class instance, but effectively are more or less like C functions plus namespace.
IMHO these two concepts are quite different, so why did the designers of C++ and later Java and C# choose the static
keyword for that behaviour? Is there a logical connection that I miss?
EDIT
I know, that static
in C does not govern accessability in a way similar to private
in C++, but can be used in that way, see https://stackoverflow.com/a/1479639/124983