Skip to content

Instantly share code, notes, and snippets.

@vasily-kirichenko
Created October 27, 2014 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vasily-kirichenko/95a2cabfba599884b61d to your computer and use it in GitHub Desktop.
Save vasily-kirichenko/95a2cabfba599884b61d to your computer and use it in GitHub Desktop.
void func()
{
int m;
class Inner
{
int foo()
{
return m; // Ok to access local variable m of func()
}
}
}
void func()
{
int m;
static int n;
static class Inner
{
int foo()
{
return m; // Error, Inner is static and m is local to the stack
return n; // Ok, n is static
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment