Bird
0
0

Which of the following is true about explicit interface implementation in C#?

easy🧠 Conceptual Q2 of 15
C Sharp (C#) - Interfaces
Which of the following is true about explicit interface implementation in C#?
AIt automatically implements interface properties as well.
BIt allows implementing multiple interfaces with methods of the same name.
CIt requires the method to be static.
DIt makes the method public and accessible from the class instance.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze purpose of explicit implementation

    Explicit interface implementation helps resolve method name conflicts when multiple interfaces have methods with the same name.
  2. Step 2: Check other options

    Explicit methods are not public on the class, do not have to be static, and do not automatically implement properties.
  3. Final Answer:

    It allows implementing multiple interfaces with methods of the same name. -> Option B
  4. Quick Check:

    Explicit implementation = resolve method name conflicts [OK]
Quick Trick: Use explicit to handle same method names in interfaces [OK]
Common Mistakes:
MISTAKES
  • Thinking explicit methods are public on class
  • Assuming explicit methods must be static
  • Believing explicit implementation auto-implements properties

Want More Practice?

15+ quiz questions · All difficulty levels · Free

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