Bird
0
0

Which of the following statements about protected members is true?

easy🧠 Conceptual Q2 of 15
C Sharp (C#) - Inheritance

Which of the following statements about protected members is true?

AProtected members are accessible only within the same assembly.
BProtected members can be accessed only within the class they are declared.
CProtected members can be accessed by any class in the same namespace.
DProtected members can be accessed by derived classes even if they are in different assemblies.
Step-by-Step Solution
Solution:
  1. Step 1: Recall protected access scope

    Protected members are accessible in the declaring class and any derived class, regardless of assembly.
  2. Step 2: Eliminate incorrect options

    Access by namespace or assembly only is incorrect for protected; those describe internal or public.
  3. Final Answer:

    Protected members can be accessed by derived classes even if they are in different assemblies. -> Option D
  4. Quick Check:

    Protected access crosses assemblies for derived classes [OK]
Quick Trick: Protected allows subclass access across assemblies [OK]
Common Mistakes:
MISTAKES
  • Assuming protected is limited to same assembly
  • Confusing protected with internal
  • Thinking protected allows access by namespace

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes