Good Idea?

I am working with a new program of and it is a large size. I need to have variables that do not go out of scope after each function. The problem with global variables is that they are used in the whole program. I am separating the functions into small namespaces though, and I declare variables in the namespaces and they don't seem to go out of scope or affect the whole program. Can anyone give me advice on if this is a good idea and some of the bad effects, if any, of doing this is. Thank you.
Last edited on
Bad idea. Just the fact that you can apparently group them together into namespaces makes it likely that the majority of your variables should be part of appropriate classes.
Thanks, I am pretty new to C++ and I don't know much about classes, so I bet its probably a good idea to look that up. (:
Ok it seems like classes are a much better option that namespaces.
Topic archived. No new replies allowed.