Skip to Content

MB-500: What Is the Best Access Modifier to Restrict Method Calls Within a Class in Dynamics 365 F&O?

How to Use Access Modifiers in X++ for Secure and Maintainable Dynamics 365 Development?

Table of Contents

Question

You are developing finance and operations apps. using the X++ development language. You have created a class and you want to add a method to it.

You want to add a method that can only be called from methods within the same class and can’t be overridden in a subclass.

You need to add an accessor keyword to that method.

Which should you use?

Select only one answer.

A. static
B. private
C. public
D. protected

Answer

B. private

Explanation

The ‘private’ keyword allows a method to be called only from methods within the same class and can’t be overridden in a subclass. ‘public’ methods can be called from anywhere the class is accessible and can be overridden by 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.