Andrei
2011-06-26 12:16:45 UTC
I've been browsing the web here and there and found something similar to this:
* Let's say you declare a global variable like so:
int iGlobalVar;
* Then you find yourself inside a code-block and wish to access the global variable:
{
// this will apparently link to the globally declared variable
extern int iGlobalVar;
}
* If I declare the latter one without the "extern" keyword, it would temporarily hide the global version of the variable
* Why do I have to use the extern keyword ?
* Why can't I just use the scope resolution operator ?
{
::iGlobalVar; // this would do the same thing right?
}
Hope I didn't annoyed you with these questions