The difference is quite simple:
A static class member works on the class and not on a instance/object of a class. In fact you can not access any data member from a static method. You only can access static members ( methods and attributes ). This is also true for calling other member functions from a static one. It will simply not work, because a static member has no idea of a class instance and is not able to call any non static method!
Under the hood a non static member function get always a hidden pointer the the instance which is simply the this pointer
from the view of the class itself. A static member do not need this kind of pointer and can not use it.
If you call a static method, you do not need to create an instance. In fact the class is only a kind of namespace. If you call a static member from an instance variable or pointer to it, the result is the same as you have no instance!
Attention must be paid to static variables. The must be defined outside the class somewhere in an object file! Normally all 'normal' members of a class will be created while creating an instance of the class. A static variable have no instance and so it must be exist somewhere else. This requires a manual definition somewhere as you can see in the example. If you have a class in a header file you can not define the variable there. Only the declaration is inside the class. The definition must be placed in an cpp-file. If you try to define your variable in the header, you can as many instances as includes for this header files which results in multiple definition errors
while linking!
Because you ask especially for protection the access to members of the class:
A static method can access static variables of the class and also can write them. But you can not use const qualification for static methods!
class A
{
public:
static void Do() { cout << "stat var " << stat_var << endl; }
void Do2() const { cout << "var" << var << endl; }
A():var(100) {}
private:
static int stat_var;
int var;
};
int A::stat_var=9;
int main()
{
A a; // instance of A a
a.Do2(); // call a method with the instance a
A::Do(); // call the static method without any instance
a.Do(); // this looks like a call with a class instance, but it is not!!!
}