Bird
0
0

Why might a developer choose explicit interface implementation over implicit in C#?

hard🧠 Conceptual Q10 of 15
C Sharp (C#) - Interfaces
Why might a developer choose explicit interface implementation over implicit in C#?
ATo make interface methods accessible only within the class.
BTo allow interface methods to be static.
CTo hide interface methods from the class's public API and avoid name conflicts.
DTo automatically implement interface properties.
Step-by-Step Solution
Solution:
  1. Step 1: Understand explicit implementation purpose

    Explicit implementation hides interface methods from the class's public interface and helps resolve method name conflicts.
  2. Step 2: Evaluate other options

    Explicit methods are not accessible only within the class, cannot be static, and do not auto-implement properties.
  3. Final Answer:

    To hide interface methods from the class's public API and avoid name conflicts. -> Option C
  4. Quick Check:

    Explicit implementation hides methods and resolves conflicts [OK]
Quick Trick: Use explicit to hide methods and avoid conflicts [OK]
Common Mistakes:
MISTAKES
  • Thinking explicit methods are private to class
  • Assuming explicit methods can be static
  • Believing explicit auto-implements properties

Want More Practice?

15+ quiz questions · All difficulty levels · Free

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