Can someone clarify something for me on how static variables work.
This is my situation:
I have a Class Screen, which has a member Field* ptrField.
I have a Class Field which has a char* str and a function int Field::edit().
I have a static int curPos in edit() which tracks what position in the string I am at.
Now if I declare static int curPos = 0; at the beginning, should this not set curPos to 0 each time I point to a new Field in my Screen class?
Basically what I am trying to do here is each time I am editing a field for the first time, it sets curPos to 0 (or beginning of the string). Each time the same field is editted, it should start from the last position it was at when edit() was exited.
So does static int curPos=0; set it to 0 the first time it is called in the program, or is it the first time it is called for each Field object. Cuz wouldnt ptrField[0].edit() be a different function in ptrField[1].edit? Or am I completely way off base here?