Chapter 2. Introducing Interfaces

A class's interface, speaking abstractly, is the collection of methods and fields that a class permits objects of other classes to access. This interface usually represents a commitment that the methods will perform the operation implied by their names and as specified by code comments and other documentation. A class's implementation is the code that lies within its methods.

C# elevates the notion of interface to be a separate construct, expressly separating interface (what an object must do) from implementation (how an object fulfills this commitment). C# interfaces allow several classes to provide the same functionality, and they open up the possibility that a class can implement more than one interface.

Several ...

Get Design Patterns in C# 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.