|
-
Feb 28th, 2004, 03:28 AM
#1
Thread Starter
Fanatic Member
Truly Global
Hello!
I was just wondering something that's kinda bugging me....
You see, i want certain variables to be able to be accessed from numerous .cpp and .h files... (all in the usual Class XXX.cpp, XXX.h pairings)
At the momemt, the easiest and cleanest thing so far i've found is to make a GLOBAL class, fill it with all the variables that i want, and then have up the top of the files:
Code:
#include "glob.h"
extern GLOB prjGlobals;
or something similar...is there an eaier way?
sql_lall 
-
Feb 28th, 2004, 01:42 PM
#2
Re: Truly Global
Originally posted by sql_lall
or something similar...is there an eaier way?
Probably not.
You may want to re-think your design though. I doubt you absolutely need those global variables.
-
Feb 28th, 2004, 02:03 PM
#3
There's a few way of providing global information to the app. The most common and probably cleanest is to have an application class, implemented as a singleton, available from everywhere through a static accessor method, that provides the global data.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|