Created
October 27, 2014 07:43
-
-
Save vasily-kirichenko/95a2cabfba599884b61d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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