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

Posted by: Pdfprep Category: 70-483 Tags: , ,

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

Answer: B

Explanation:

Protected – The type or member can be accessed only by code in the same class or structure, or in a class that is derived from that class.

The protected keyword is a member access modifier. A protected member is accessible within its class and by derived class instances.

Reference: http://msdn.microsoft.com/en-us/library/ms173121.aspx

Leave a Reply

Your email address will not be published.