I was wondering about working with mulitple source files. In the project that I'm working on at the moment, I have several header files and several cpp files. The only problem is that in one or two of the classes (which are in separate header files), there are a few methods I made which take the a handle to the window (really its a HWND handle, but in the example below I used a HANDLE handle), I was wondering if there is any way of making a variable visible to just a few header files? I've heard of the extern keyword being used for something similar to that, but never used it. Is there a better way to do it than just declare it as a global variable and make it visible to all source code files? Is there any way to pass source code files arguments, like functions and methods, so if I passed an argument to example.h then that would be like a global variable declaration in example.h?
In the example above, I have methods in EXAMPLE1, which take hOut as a parameter, but I wanna keep hOut local, but if I do that, I have problems with the way the methods are defined in example1.h
<---- Position (2) - See comment below
int main(int argc, char *argv)
Also, even if I declare it at position (2) in the code, it isn't visible to example1.h, how do you think I should solve these problems?