MB6-704 · Question #88
You have the following X++ code: (Line numbers are included for reference only.) Methodl and method2 are in Classl. Method3 is in Class2. You need to set variablel for classlObj to a value of 5…
The correct answer is A. classl0bj.methodl(5). All classes are public, but all member variables are implicitly private. Use a public Setter Accessor method, here method1, on Obj1 to change the variable of the other class. Add a Setter Accessor Method Follow these steps to add a method that sets the value of a member…
Question
You have the following X++ code: (Line numbers are included for reference only.) Methodl and method2 are in Classl. Method3 is in Class2. You need to set variablel for classlObj to a value of 5. Which code segment should you insert at line 21?
Exhibit
Options
- Aclassl0bj.methodl(5);
- Bnew Classl().methodl(5);
- CclasslObj.variable1= 5;
- Dthis.variablel =5:
How the community answered
(32 responses)- A72% (23)
- B13% (4)
- C6% (2)
- D9% (3)
Explanation
All classes are public, but all member variables are implicitly private. Use a public Setter Accessor method, here method1, on Obj1 to change the variable of the other class. Add a Setter Accessor Method Follow these steps to add a method that sets the value of a member variable: 1. Right-click the Class1 node, and then click New > Method. 2. Rename the method1 node to setFirstName. 3. In the code Editor window, paste in the following X++ code for the method. public void setFirstName(str _firstName) firstName = _firstName;
Topics
Community Discussion
No community discussion yet for this question.
