I have to ask this question because I feel that only experienced programmers can learn about the pros and cons of static members in a class. I read books about static members, I also used a lot of static members in my project according to my points of view.
As I understand it, if there is some class that is used only once in my project, I mean that there is no need to create several or several instances, I have to make all its elements static, especially static. It's true? This has another advantage because calling static members can be easily done without creating new instances or passing instances between our classes.
Using static elements in my projects does not show me what is wrong with it, my project seems to work fine, of course, I don't mean that I like to use static members and use it randomly, often (as I explained my point of view above). I think there may be some pros and cons to static members (which I donโt know), and I would like to know from your experience. Please share with me.
Thanks!
source share