For example, I was making a TD game to play around with classes and my main problem was communicating between them.
From my document class I check the current level and initiate the level class, create the grid using the grid class and from within that(the level class) all the enemies are made(initiating the enemy class for each enemy).
The enemies are placed and moved in accordance to an array from within the level class, using a function within the enemy class.
So the enemies are attached at a set time given in the level class, moved with a function from their own class using coordinates from the level class...
Towers are made when a button is clicked(made with the interface class). They check the coordinates of the enemies and call one of their functions to shoot at it.
...
Anyways, to do all this I have to have communication between them. Which was a problem for me. I came upon something called a Singleton. I'm not sure what it is, but it's a sort of global container. I import that class everywhere I need information shared and access them using a dot operator. "global.myVar1, global.myArray2, etc".
My questions are:
Is this the right approach to OOP? Am I over complicating things? What exactly is a singleton? How would you share info across classes?