8. Interfaces

Polymorphism is available not only via inheritance (as discussed in Chapter 7) but also via interfaces. Unlike abstract classes, interfaces cannot include any implementation. Like abstract classes, however, interfaces define a set of members that callers can rely on being implemented.

A figure shows the "Interface" mind-map.

By implementing an interface, a type defines its capabilities. The interface implementation relationship is a “can ...

Get Essential C# 7.0, Sixth Edition 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.