Difficulty: Easy
Correct Answer: This is a perfectly workable interface.
Explanation:
Introduction / Context:
Interfaces in C# define member signatures without implementation. This problem verifies whether properties and methods can be declared in an interface and whether bodies are required.
Given Data / Assumptions:
Concept / Approach:
In classic C#, interface members have signatures only. Implementing types must provide bodies. Properties in an interface are declared with get; and/or set; accessors — again, without bodies. Methods (void or returning values) are allowed and, similarly, have no bodies in the interface.
Step-by-Step Solution:
Verification / Alternative check:
Create a class Employee : IPerson and implement each member. The compiler will require bodies in the class.
Why Other Options Are Wrong:
Common Pitfalls:
Trying to put code into interface accessors or methods; implementation belongs in classes/structs that implement the interface.
Final Answer:
This is a perfectly workable interface.
Discussion & Comments