Practice mode C#

What is the default accessibility of a member declared inside a C# class with no access modifier?

Correct answer B. private

Explanation

Class and struct members default to private, so they are visible only inside the containing type. Top-level types such as a class declared directly in a namespace default to internal, meaning visible within the same assembly. Interface members are public by default. Stating the modifier explicitly is recommended so intent is clear.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

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

Links and website addresses are not allowed in comments.