Chapter 8: Interfacing with the Interface

In This Chapter

check.png Going beyond IS_A and HAS_A: The C# interface

check.png Creating your own interface or using one provided by .NET

check.png Unifying separate class hierarchies with interfaces

check.png Hiding part of your class’s public interface behind an interface

check.png Managing software change — flexibility via interfaces

A class can contain a reference to another class; this statement describes the simple HAS_A relationship. One class can extend another class by way of the marvel of inheritance — that’s the IS_A relationship. The C# interface implements another, equally important association: the CAN_BE_USED_AS relationship.

This chapter introduces C# interfaces and shows some of the numerous ways they increase the power and flexibility of object-oriented programming.

Introducing CAN_BE_USED_AS

If you want to jot a note, you can scribble it with a pen, type it into your smartphone, or pound it out on your laptop’s keyboard. You can fairly say that all three objects — pen, ...

Get C# 5.0 All-in-One For Dummies 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.