Quote Originally Posted by donglebob View Post
Are instance variables always protected from other threads?
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++.

Quote Originally Posted by donglebob View Post
What can I do when I want that two threads want to use the same variable(s)?
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.