Single Choice Easy

QWhat does the following X++ code snippet achieve?

void new(real _x = 10, real _y = 10)
{
    x = _x;
    y = _y;
}

ID: #12096 Classes in D365 F&O X++ 220 views
Question Info
#12096Q ID
EasyDifficulty
Classes in D365 F&O X++Topic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A It defines a method called "new" that initializes variables x and y to default values of 10 each.
  • B It creates a constructor named "new" with parameters _x and _y, and initializes variables x and y with the provided values.
  • C It defines a default constructor that initializes variables x and y to the values of _x and _y.
  • D It declares a class with default values of 10 for variables x and y, which can be accessed using the "new" method.
Correct Answer

Explanation

  • It creates a constructor named "new" with parameters _x and _y, and initializes variables x and y with the provided values.

  • Explanation: In X++, the code defines a constructor named "new" with optional parameters _x and _y. This constructor is used to initialize the values of the variables x and y when an object of the class is created. If no values are provided, the default values of 10 are used.

Share This Question

Challenge a friend or share with your study group.