jeudi 15 août 2019

Using static keyword for both class member functions and class variables good or bad practice, especially for multithreading?

In terms of designing a class, I want to know if using static keyword for either member variables or member functions is good or bad practice.

Of course, this question most likely depends on what the use case is however, in terms of multi-threading I feel like that it introduces more problems then it solves. May be it is due to my misunderstanding but, wouldn't static cause the class to become harder to track the state and thus become harder to make the class thread safe?

When would it be appropriate to use statics in a class might be a better question?

Aucun commentaire:

Enregistrer un commentaire