For c language, a static variable can only be used within the file in
which it is defined.
But for c++, a class's static data member can be used in other files.
Is it contradictory?
Sort of. In C++, the keyword static is overloaded, depending on
context. When applied to a variable at namespace scope, it
means internal linkage, i.e. that the same name in another
translation unit refers to a different entity. When applied to
a variable at class scope, it means that the variable exists
once, independently of any instance of the class---all class
members always have the same linkage as the class (which is
external unless the class is local). For local variables, the
keyword also has no effect on linkage. (The meaning of static
for local variables and class variables is actually somewhat
related: one instance, present always.)