Original Post
First of all, good day gentlemen.
Although the tile says coding style, my problem isn't really with whitespace, commenting, variable notation or any such thing.
I'll try to explain:
Imagine i have a class for data management (responsible for holding sounds, images, etc). Then i make a class that displays some graphics on the screen, and another that plays a sound. Both these classes need data from the data management class, so how would i do this (this does not extends just to classes, but variables in general)?
Should i make the data management class global, and access it in the audio and graphics class like a global var? Or should a define the data class inside the program as a private var, and pass it in the functions that display the graphics and plays the sound, every time i want to do so?
It's not that i can't make it work, but i'd like to have your opinions on how should i do it, to establish some kind of standard in my programming, (another example, should i defined the variables i need inside the main, and pass them along to any function that needs them?).
So, i'd really appreciate any answers, and if possible, to know how you do it in your projects/programs.
Thanks in advance.
Although the tile says coding style, my problem isn't really with whitespace, commenting, variable notation or any such thing.
I'll try to explain:
Imagine i have a class for data management (responsible for holding sounds, images, etc). Then i make a class that displays some graphics on the screen, and another that plays a sound. Both these classes need data from the data management class, so how would i do this (this does not extends just to classes, but variables in general)?
Should i make the data management class global, and access it in the audio and graphics class like a global var? Or should a define the data class inside the program as a private var, and pass it in the functions that display the graphics and plays the sound, every time i want to do so?
It's not that i can't make it work, but i'd like to have your opinions on how should i do it, to establish some kind of standard in my programming, (another example, should i defined the variables i need inside the main, and pass them along to any function that needs them?).
So, i'd really appreciate any answers, and if possible, to know how you do it in your projects/programs.
Thanks in advance.