Bird
0
0

What must a class do when it implements an interface in C#?

easy🧠 Conceptual Q1 of 15
C Sharp (C#) - Interfaces
What must a class do when it implements an interface in C#?
ADeclare the interface methods as private
BInherit from the interface as a base class
CProvide implementations for all interface methods
DCreate a new interface inside the class
Step-by-Step Solution
Solution:
  1. Step 1: Understand interface contract

    An interface defines method signatures without implementations.
  2. Step 2: Implement all interface methods in the class

    The class must provide code for every method declared in the interface.
  3. Final Answer:

    Provide implementations for all interface methods -> Option C
  4. Quick Check:

    Interface implementation = Provide all methods [OK]
Quick Trick: Implement all interface methods to fulfill the contract [OK]
Common Mistakes:
MISTAKES
  • Trying to inherit interface as a class
  • Not implementing all interface methods
  • Making interface methods private

Want More Practice?

15+ quiz questions · All difficulty levels · Free

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