|
-
August 12th, 1999, 04:42 PM
#1
Gloabal objects
Is there anyway in C++ of declaring a global object? I want to create a single workspace object for my DB appliction, and access this object from my entire application. Any way of achieving this?
Regards, Phil Messenger
-
August 12th, 1999, 06:07 PM
#2
Re: Gloabal objects
Are your "entire app" and "DB app" different exe-s?
If so, what do you want? If you want just exchange by messages beetwen apps you can registr
your custom messages for the exchange.
Another way - create separate thread and exchange
with this thread by SetEvent, while the thread will be "WaitForMultipleObject"
Dmitriy, MCSE
-
August 12th, 1999, 10:06 PM
#3
Re: Gloabal objects
You declare a global anything by putting it in a .cpp file outside of any function, such as directly after you #includes. If you need to use the global in another .cpp file use the 'extern' keyword in front of the declaration. No redefinition is needed. You do seem to be defeating the purpose of object oriented programming, however. OOP procedures are developed to minimize problems, so following them will make life easier (or at least programming). Try keeping your workspace object in your CDocument class and access it from there.
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
|