Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Public Variables

Status
Not open for further replies.

Mark82

Programmer
Aug 24, 2002
2
0
0
NZ
Hi there I am a visual Basic programmer making the change over to C++ I was wondering if any one could tell me how to declare a public Variable and where to put it and do on,

Also could any one tell me some good links where i can speed up my learning tutorials etc,
BTW I am using Visual C++ 6.0
 
Hi

declare in your application implementation file (FooApp.cpp) the global variable as this (as an example):

int m_nGlobalVar;

In the interface files that needs to reach the variable, add the following line, outise any class definition:

extern int m_globalVar;

BTW, avoid as much as you can the use of global variables

Thierry

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top