Chapter 8. Interfaces

Interfaces are types that enable you to define multiple classes that have similar functionality. Let’s suppose you had a class named Escort. The Escort class has methods like Run, Stop, PlayMusic, etc. You’re happy with the Escort class because it enables you to come to and from work. At some point, however, your friends begin to make fun of your Escort class, and you would like to replace the Escort class with the Ferrari class. Before you replace the Escort class with the Ferrari class, you want to make sure that the Ferrari class at least has the same functionality as the Escort class. It should Run, Stop, and PlayMusic. It may do all those things differently than the Escort class, but the point is that it at least has ...

Get C# Web Development with ASP.NET: Visual QuickStart Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.