I have these C++ classes:
class Base { protected: static int method() { static int x = 0; return x++; } }; class A : public Base
If you are making X as static then it will be shared among all the child classes. No issues with the function being static.