Which access modifier should you use for the GetData() method?

An application includes a class named Person. The Person class includes a method named GetData.
You need to ensure that the GetData() from the Person class.
Which access modifier should you use for the GetData() method?
A. Internal
B. Protected
C. Private
D. Protected internal
E. Public

microsoft-exams

2 thoughts on “Which access modifier should you use for the GetData() method?

  1. The complete question is:

    An application includes a class named Person. The Person class includes a method named GetData.
    You need to ensure that the GetData() method can be used only by the Person class and not by any class derived from the Person class.
    Which access modifier should you use for the GetData() method?

    And the correct answer should be C. Private

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.