area where an item is accessed.Scopes in X++Instance variables, declared in class declarations, can be accessed from any
methods in the class, and from methods in sub-classes that extend the class.
Local variables can be accessed only in the method in which they are defined.
1: public class ANewClass
2: {
3: int abc;
4: }
5: private void aNewMethod()
6: {
7: int xyz;
8: }
Variable abc is declared in the classDeclaration of ANewClass and variable xyzis declared in aNewMethod. The variable xyz can only be used within the scopeof the method aNewMethod, but the variable abc can be accessed by all methods
in the class.
Best Regards,
Hossein Karimi
No comments:
Post a Comment