If the identifier is static, then it will have the same value for all instances of the class.
If you want each instance to have consistent id values, you could combine a static attribute with a class variable, for example:
class Data { private: static int ID; int thisId; public: Data(){ thisId = ++ID; } }; int Data::ID = 0;
If the application is multithreaded, you will have to synchronize it with something like a pthread mutex.
Brady source share