Preamble:
This occurred running on Finance and Operations (Dynamics 365) - (Platform Update57) 7.0.6861.86 extension for Visual Studio.
Historically the x++ langauge has not had great support for access modifiers. The original workings was, that all class members in a class were private, and could not be accessed, by code outside the class, unless ofcourse you made a (parm) method giving access to change or just get something.
Methods could have access modifiers but they were seldom used and were always public, unless you explicitly wrote something else.
Somewhere a long the lines in D365 x++ has evolved to be more c#-like and therefor you can now put access modifiers on you class members, so that if you declare a class member public, you do not actually need to write an access (parm) method.
However, the x++ compiler has it's quirks it seems.
Consider this class declaration:
internal final class MOLSOPackingSlipFromReceivedTransitGoodsUpdater
{
public QueryRun queryRun;
private ITMTable voyage;
private SalesFormletterParmData salesFormLetterParmData;
private SalesParmUpdate salesParmUpdate;
.
.
.
}
Note that the queryRun object is declared public and can there for be accessed from outside and inside the class as well.
Consider the run method in the same class:
public void run()
{
SalesId previousSalesId;
previousSalesId = '';
ITMLine voyageLine;
PurchLine purchLine;
SalesLine refSalesLine;
SalesParmTable salesParmTable;
SalesFormLetter salesFormLetter;
ttsbegin;
while (this.queryRun.next())
{
.
.
.
}
.
.
.
// Reiterate query
.
.
.
}
this.queryRun.reset();
statement does not compile.
.
}
Nice blog, thank you for sharing with us.
ReplyDeleteBest Application Development Company.