Single Choice Easy

QYou are to complete the code needed to create methods in a class with inheritance. You would like your method accessible to any class in the system. Which will best complete this statement?

____ void getFromDialog()
    {
  ~~~Body of code ~~~
        super();
    }

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

Choose the Best Option

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

  • A public
  • B private
  • C protected
  • D void
Correct Answer

Explanation

Justification:

  1. The public keyword is used to make the given method accessible from any other class in the system.
  2. The private keyword only allows access from within the scope of the given method. This prevents accidental or unintentional re-use.
  3. The protected keyword allows access to any subclasses that may extend the class that the method resides in. However, it prevents access from all other outside object calls.
  4. The void keyword is already explicitly stated in the code snippet, and should not be used twice. This indicates that the given method does not return a value. The void keyword is used in conjunction with the scoping keywords: private, public and protected.

 

Related Lesson: Best Practices

Share This Question

Challenge a friend or share with your study group.