Bird
Raised Fist0

You have two interfaces:

hard🚀 Application Q15 of Q15
C Sharp (C#) - Interfaces
You have two interfaces:
interface IWalk { void Walk(); }
interface ITalk { void Talk(); }

How can a class Human implement both interfaces correctly?
Ainterface Human : IWalk, ITalk { }
Bclass Human : IWalk { public void Walk() { } } class Human : ITalk { public void Talk() { } }
Cclass Human implements IWalk, ITalk { }
Dclass Human : IWalk, ITalk { public void Walk() { Console.WriteLine("Walking"); } public void Talk() { Console.WriteLine("Talking"); } }
Step-by-Step Solution
Solution:
  1. Step 1: Understand multiple interface implementation

    A class can implement multiple interfaces by listing them separated by commas.
  2. Step 2: Provide all required methods

    Human class must provide Walk() and Talk() methods with code.
  3. Final Answer:

    class Human : IWalk, ITalk { public void Walk() { Console.WriteLine("Walking"); } public void Talk() { Console.WriteLine("Talking"); } } -> Option D
  4. Quick Check:

    Multiple interfaces implemented with all methods [OK]
Quick Trick: Separate interfaces with commas and implement all methods [OK]
Common Mistakes:
MISTAKES
  • Trying to declare multiple classes with same name
  • Using 'implements' keyword (Java style)
  • Declaring interface instead of class

Want More Practice?

15+ quiz questions · All difficulty levels · Free

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