Tuesday, July 3, 2018

Scoping and Parameters in X++

In X++ variables and methods are within a well-defined scope. A scope is the
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 scope
of 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

Configure the Firewall on the Enterprise Portal Server

After you install Enterprise Portal, enable Web Server (HTTP) in Windows Firewall. If you do not enable the web server in Windows Firewall...