Bird
0
0

Which of the following is the correct syntax for explicit interface implementation of method Show() from interface IExample in class Demo?

easy📝 Syntax Q12 of 15
C Sharp (C#) - Interfaces
Which of the following is the correct syntax for explicit interface implementation of method Show() from interface IExample in class Demo?
Apublic void Show() { }
Bpublic void IExample.Show() { }
Cvoid IExample.Show() { }
Dvoid Show() IExample { }
Step-by-Step Solution
Solution:
  1. Step 1: Recall explicit implementation syntax

    Explicit interface methods are implemented with the interface name before the method: void InterfaceName.MethodName().
  2. Step 2: Match correct syntax

    void IExample.Show() { } matches this pattern exactly: void IExample.Show() { }.
  3. Final Answer:

    void IExample.Show() { } -> Option C
  4. Quick Check:

    Explicit syntax = void Interface.Method() [OK]
Quick Trick: Explicit methods use interface name before method [OK]
Common Mistakes:
MISTAKES
  • Adding public modifier to explicit method
  • Placing interface name after method name
  • Using invalid syntax like 'void Show() IExample'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

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