Q:
You are working on a project that involves the development of a new class in X++ for Microsoft Dynamics 365 finance and operations apps.
You need to create a subclass that extends an existing superclass and overrides one of its methods to customize its behavior.
What three steps should you perform? Each correct answer presents part of the solution. Choose three.
-
A
Create a new class and use the 'extends' keyword to specify the superclass it should inherit from.
-
B
Add the desired functionality to the overridden method in the subclass.
-
C
In the subclass, declare a method with the same name and parameters as the method in the superclass.
-
D
A, B, C
D
Answer:
D
Explanation:
Wrong: Use the 'final' keyword when declaring the subclass to prevent further inheritance.
Wrong: Declare the method to be overridden in the subclass as 'private'.
Wrong: Use the 'overload' keyword to change the functionality of the inherited method.
To create a subclass that extends a superclass, you need to create a new class and use the 'extends' keyword to specify the superclass it should inherit from. To override a method from the superclass, you need to declare a method with the same name and parameters in the subclass and add the desired functionality. Using the 'final' keyword when declaring the subclass would prevent further inheritance, which is not required in this scenario. Declaring the method to be overridden as 'private' would make it inaccessible from the subclass. The 'overload' keyword does not exist in X++, so it cannot be used to change the functionality of the inherited method.
X++ inheritance - Finance & Operations | Dynamics 365 | Microsoft Learn
Add code and methods to meet business requirements - Training | Microsoft Learn
Related Topic:
Share Above MCQ