Implicit Implementation
It is easy to implement a single interface on a class or struct. It simply requires declaration of the class or struct with interface inheritance and the implementation of those interface members. There are two views of implicit interface implementation. The first is the easiest: a single class implementing a single interface. The second uses interface polymorphism by implementing the same interface in two separate classes.
Single Class Interface Implementation
As I mentioned previously, it is easy for a class to implement a single interface. Implementation of an interface simply follows the rules set in previous sections. Listing 14.1 shows the full interface definition.
Listing 14.1. The IBroker Interface Definition ...
Get C# Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.