Globals in MFC
Posted
by Petr Stejskal
on February 13th, 1999
MFC class framework makes possible to work easily with global variables and functions. Let's declare a static member variable or function in the CWinApp derived class. It is accessible from all classes.
Example:
// MyApp.h
class CMyApp : public CWinApp
{
public:
CMyApp();
static int g_nMyVariable; // declaration
static void g_MyFunction(); // declaration
...
etc
...
};
// MyApp.cpp
int CMyApp::g_nMyVariable = NULL; // definition & initialization
void CMyApp::g_MyFunction() // definition
{
}
Now the variable and the function are accessible through the syntax CMyApp::g_nMyVariable or CMyApp::g_MyFunction from any other class...

Comments
EKoHY NkY RYtU
Posted by wfAahmllrb on 11/15/2012 08:45pmbuy soma carisoprodol grapefruit juice - can you really buy soma online
ReplyvetqI Ibm TMZI
Posted by cVNExPQHwR on 11/14/2012 01:57amcarisoprodol 350 mg carisoprodol 350 mg erowid - somanabolic muscle maximizer side effects
Reply