Difficulty: Easy
Correct Answer: 2, 5
Explanation:
Introduction / Context:
This item tests knowledge of which access modifiers allow a derived class to access base-class members in C#.
Given Data / Assumptions:
protected members are visible to derived classes.public members are visible everywhere, including in derived classes.private members are not visible outside the declaring class.static (and VB’s shared) describe storage/dispatch, not accessibility by themselves.
Concept / Approach:
Accessibility is determined by access modifiers like public, protected, internal, etc. Whether a member is static or instance is orthogonal to accessibility; a member can be public static or protected static.
Step-by-Step Solution:
Verification / Alternative check:
Create a base with protected and public members and access them from a derived type; attempting to access private will cause a compile error.
Why Other Options Are Wrong:
They include private or confuse static/shared with accessibility.
Common Pitfalls:
Assuming static implies global accessibility. It does not.
Final Answer:
2, 5
Discussion & Comments