How to Use Public Access Modifier for Overridable Methods in Dynamics 365 F&O?
Table of Contents
Question
You are working on finance and operations apps using X++. You have created a class and now you need to add a method to it.
You will add a method that can be called from anywhere the class is accessible and can be overridden by a subclass.
You need to add an accessor keyword to that method.
Which should you use?
Select only one answer.
A. private
B. public
C. protected
D. static
Answer
B. public
Explanation
The ‘public’ keyword allows a method to be called from anywhere the class is accessible and can be overridden by a subclass. ‘private’ methods can only be called from methods within the same class and can’t be overridden in a subclass. ‘protected’ methods can only be called from methods in the same class or methods in a subclass of that class. ‘static’ is not an accessor keyword, it’s used to declare a method that belongs to a class, not an instance of the class.
Microsoft Dynamics 365: Finance and Operations Apps Developer MB-500 certification exam practice question and answer (Q&A) dump with detail explanation and reference available free, helpful to pass the Microsoft Dynamics 365: Finance and Operations Apps Developer MB-500 exam and earn Microsoft Dynamics 365: Finance and Operations Apps Developer MB-500 certification.