Which of the following is true about default interface methods in C#?
easy🧠 Conceptual Q2 of 15
C Sharp (C#) - Interfaces
Which of the following is true about default interface methods in C#?
AThey allow interfaces to provide method implementations.
BThey require all implementing classes to override the method.
CThey can only be static methods.
DThey cannot access other interface members.
Step-by-Step Solution
Solution:
Step 1: Recall the purpose of default interface methods
Default interface methods allow interfaces to include method bodies, providing implementations.
Step 2: Evaluate each option
They allow interfaces to provide method implementations. is correct; options B, C, and D are false because overriding is optional, methods can be instance methods, and default methods can access other members.
Final Answer:
They allow interfaces to provide method implementations. -> Option A
Quick Check:
Default interface methods provide implementations = A [OK]
Quick Trick:Default methods add implementation to interfaces [OK]
Common Mistakes:
MISTAKES
Believing all default methods must be overridden
Thinking default methods are only static
Assuming default methods cannot access interface members
Master "Interfaces" in C Sharp (C#)
9 interactive learning modes - each teaches the same concept differently