I am new to OOP. Before I did my best never to use global variables and it worked fine. But with OOP I find that I am starting to use global variables... very frustrating indeed. How do you prevent it? Let me give you an example.
Assume you have a class called World. It has a wide range of variables and functions that operate on those variables.
If this function call uses other functions local to the World class and changes variables (lets say temperatures in the World), you find your self in a situation where functions inside world uses global variables (global inside World).
With smaller classes I have no problem but when it gets big like this, I find myself using tons of global variables... :-(
Should you pass World variables as arguments between functions inside World perhaps??
Any input is very welcome! Thanks!!