Click here to Skip to main content
15,915,828 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralPassing an array of UDT from Excel to C++ DLL Pin
Anton A. Loukine29-Apr-03 9:54
Anton A. Loukine29-Apr-03 9:54 
GeneralChanging the Header height in CListCtrl Pin
ttohme29-Apr-03 9:46
ttohme29-Apr-03 9:46 
Generalunable to access static variable Pin
act_x29-Apr-03 9:14
act_x29-Apr-03 9:14 
GeneralRe: unable to access static variable Pin
David Crow29-Apr-03 9:31
David Crow29-Apr-03 9:31 
GeneralRe: unable to access static variable Pin
act_x29-Apr-03 9:37
act_x29-Apr-03 9:37 
GeneralRe: unable to access static variable Pin
Dave Bryant29-Apr-03 9:50
Dave Bryant29-Apr-03 9:50 
GeneralRe: unable to access static variable Pin
act_x29-Apr-03 9:52
act_x29-Apr-03 9:52 
GeneralRe: unable to access static variable Pin
Chris Losinger29-Apr-03 10:57
professionalChris Losinger29-Apr-03 10:57 
act_x wrote:
Having done this I'd like to know why this is essential

think of it this way: a static member variable (different from a static member function) exists outside the lifetime of any single instance of the class it's declared in. therefore you need to give it a place to live outside the class. by adding that single line to the cpp, you've given it a place to live. the line in the header only tells the compiler "this variable will be of this type, i'll allocate space for it somewhere else".

another way to think of statics is that they're basically global variables that can only be addressed in the context of the class they're declared in: cFoo::myVariable.

-c


QuestionGrouping on Taskbar? Pin
netx200329-Apr-03 8:40
netx200329-Apr-03 8:40 
AnswerRe: Grouping on Taskbar? Pin
David Crow29-Apr-03 9:05
David Crow29-Apr-03 9:05 
GeneralRe: Grouping on Taskbar? Pin
netx200329-Apr-03 9:14
netx200329-Apr-03 9:14 
GeneralRe: Grouping on Taskbar? Pin
David Crow29-Apr-03 9:22
David Crow29-Apr-03 9:22 
GeneralRe: Grouping on Taskbar? Pin
netx20031-May-03 7:41
netx20031-May-03 7:41 
GeneralRe: Grouping on Taskbar? Pin
David Crow1-May-03 7:50
David Crow1-May-03 7:50 
GeneralHide Frame from task bar Pin
netx200329-Apr-03 8:40
netx200329-Apr-03 8:40 
Questionhow can iset dialog font by coding Pin
liquidsnake18329-Apr-03 8:18
liquidsnake18329-Apr-03 8:18 
AnswerRe: how can iset dialog font by coding Pin
David Crow29-Apr-03 8:19
David Crow29-Apr-03 8:19 
QuestionHow to call a function from another class Pin
gmlnd29-Apr-03 8:02
gmlnd29-Apr-03 8:02 
AnswerRe: How to call a function from another class Pin
David Crow29-Apr-03 8:18
David Crow29-Apr-03 8:18 
GeneralRe: How to call a function from another class Pin
gmlnd29-Apr-03 8:25
gmlnd29-Apr-03 8:25 
GeneralRe: How to call a function from another class Pin
David Crow29-Apr-03 8:28
David Crow29-Apr-03 8:28 
GeneralRe: How to call a function from another class Pin
gmlnd29-Apr-03 8:40
gmlnd29-Apr-03 8:40 
GeneralRe: How to call a function from another class Pin
David Crow29-Apr-03 9:03
David Crow29-Apr-03 9:03 
GeneralRe: How to call a function from another class Pin
gmlnd29-Apr-03 9:38
gmlnd29-Apr-03 9:38 
GeneralRe: How to call a function from another class Pin
David Crow29-Apr-03 10:34
David Crow29-Apr-03 10:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.