They mean different things. In a class
context, static
means that methods do not required an object to act on, so are more like free functions. In a namespace
context, it means that the functions have internal linkage so are unique to the translation unit that they are defined in.
In addition, the members of a class
are private by default so, as written, your class functions are only callable from each other. You would need to add a public:
access specifier or make the class
a struct
to change this.
If you need a bunch of free functions and don't need class objects then it's probably more suitable to define them as non-static
functions in a namespace. If they are defined in line in a header file, then they usually need to be declared inline
. This is implied if they are defined in a class
.