struct A { static int id; static int genId() { return id++; } }; int function() { A::id = 0; // call to a static attribute return A::gendId(); // call to a static method }