Hey all,
Simple question here:
During the construction of my code I came across a simple question; are the variable that are instantized within member functions of a class private to that function only, or are they seen by all members.
Suppose I use create an int 'i' in a for loop for the member function 'dothis();'; will that same int be recognised by another member function, or can I reuse the name 'i' else where in the class?
Note that int i was not defined in the header file for the class, it is just a throw away variable...
![]()
If I understood you right, you are asking whether a variable that is declared in some function, is seen and recognized by other functions. If thats the question, the answer is no - it is a local variable - it means its only seen in the scope which it is defined in.
Thanks!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks