C Sharp (C#) - InterfacesWhat is the main purpose of default interface methods in C#?AAllow interfaces to have method bodies with default behaviorBForce all implementing classes to override every methodCPrevent interfaces from having any methodsDMake interfaces behave like abstract classesCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand interface limitations before default methodsInterfaces could only declare methods without bodies, forcing all implementations to define them.Step 2: Recognize the role of default interface methodsDefault interface methods allow interfaces to provide a method body, so implementing classes can use or override it.Final Answer:Allow interfaces to have method bodies with default behavior -> Option AQuick Check:Default interface methods = method bodies in interfaces [OK]Quick Trick: Default interface methods add bodies to interfaces [OK]Common Mistakes:MISTAKESThinking interfaces cannot have any method bodiesConfusing default methods with abstract methodsBelieving all methods must be overridden
Master "Interfaces" in C Sharp (C#)9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More C Sharp (C#) Quizzes Classes and Objects - Static members vs instance members - Quiz 3easy Classes and Objects - Object instantiation with new - Quiz 1easy Collections - Dictionary key-value collection - Quiz 6medium Collections - LinkedList usage - Quiz 15hard Collections - Dictionary methods and access patterns - Quiz 13medium Exception Handling - When clause in catch - Quiz 9hard Exception Handling - Multiple catch blocks - Quiz 6medium Inheritance - Protected access modifier - Quiz 4medium Polymorphism and Abstract Classes - Why polymorphism matters - Quiz 12easy Polymorphism and Abstract Classes - Runtime polymorphism execution - Quiz 12easy