You created two objects. If 'i' is a normal class member, then each created object has its own instance of the variable. This has nothing to do with threads and protecting variables. This is just how classes and objects work in C++.
You can make the 'i' member a static member. Then there would be only one instance of 'i', no matter how many objects you create.
Bookmarks