Who can access it if a method is marked as protected internal? - ProProfs Discuss
Topics
Products
Follow Us:

Who can access it if a method is marked as protected internal?



A. Classes that are both in the same assembly and derived from the declaring class.
B. Only methods that are in the same class as the method in question.
C. Internal methods can only be called using reflection.
D. Classes within the same assembly, and classes derived from the declaring class.

This question is part of C# Skills Test
Asked by Wyatt Williams, Last updated: Jun 03, 2020

+ Answer
Request

3 Answers

E. Stanley

E. Stanley, Technical writer, Indianapolis

Answered Jul 17, 2018

If the method is simply marked as protected it is only visible to the inheriting types. However, if it is marked as protected internal, it is visible to classes within the same assembly and classes derived from the declaring class. This means that all members in a specific class will be able to visualize the method.

Different settings provides users with the option of modulating which people can access the method. If you want to privatize the method, you can easily do so by changing the marking of the method. Different options will make it visible to only the select few personnel that you allowed.

 

aespoir

Aespoir

Answered Jan 08, 2017

Protected: Members are only visible to inheriting types.
Protected internal: Members are only visible to inheriting types and also to all types that are also contained within the same assembly as the declaring type.

 

John Smith

John Smith

Answered Jan 08, 2017

Classes within the same assembly, and classes derived from the declaring class.
 

Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer

Email Sent
We have sent an email to your address "" with instructions to reset your password.