Style/Structuring question: One vs. multiple global objects

Deewiant deewiant.doesnotlike.spam at gmail.com
Mon Jul 2 21:32:14 PDT 2007


Lutger wrote:
> First think about if they really need to be global variables. Does you
> renderer need to access the sound system? Does your window class need to
> know the main character and that character need to know the screen width
> and height? All these things you mention do not need to be global.

Not global per se, but they can be module-level variables with the "package"
privacy specifier. Thus you can have foo.sound.globals which can only be
accessed by the sound system.

-- 
Remove ".doesnotlike.spam" from the mail address.


More information about the Digitalmars-d-learn mailing list