Practice mode C#

Since C# 8, what can an interface member include that it could not before?

Correct answer B. A default implementation used when the implementing class does not provide one

Explanation

Default interface methods let an interface supply a body for a member. Existing implementing classes then inherit that behaviour, so library authors can add members without breaking them. Interfaces still cannot declare instance fields or constructors. The default implementation is only reachable through the interface type, so you call it via a variable of the interface type.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.