...

/

Implementing Interface: Implicit, Explicit, and Default

Implementing Interface: Implicit, Explicit, and Default

Learn about implicit and explicit interface implementations, how to define interfaces with default implementations, and their usage.

Implicit and explicit interface implementations

Interfaces can be implemented implicitly and explicitly. Implicit implementations are simpler and more common. Explicit implementations are only necessary if a type must have multiple methods with the same name and signature.

For example, IGamePlayer and IKeyHolder might have a method called Lose with the same parameters because both a game and a key can be lost. In a type that must implement both interfaces, only one implementation of Lose can be the implicit method. If both ...