Created
July 5, 2017 19:14
-
-
Save bnchdrff/2d67c586f6a3118ab0ceda4dc14ff3f7 to your computer and use it in GitHub Desktop.
scope in salesforce apex
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
class FoobarTest { | |
String bar; | |
public String messyScope() { | |
String bar; | |
bar = 'messy'; | |
return bar; | |
} | |
public String messierScope() { | |
String bar; | |
bar = 'messier'; | |
return bar; | |
} | |
public String messiestScope() { | |
bar = 'messiest'; | |
return bar; | |
} | |
public String upperScope() { | |
return bar; | |
} | |
} | |
FoobarTest fbt = new FoobarTest(); | |
System.debug(fbt.messyScope()); // messy | |
System.debug(fbt.upperScope()); // null | |
System.debug(fbt.messiestScope()); // messiest | |
System.debug(fbt.upperScope()); // messiest | |
System.debug(fbt.messierScope()); // messier | |
System.debug(fbt.upperScope()); // messiest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment