Chapter 7
Interfacing with the Interface
IN THIS CHAPTER
Going beyond IS_A and HAS_A
Creating and using interfaces
Unifying class hierarchies with interfaces
Managing flexibility via interfaces
A class can contain a reference to another class, which describes the simple HAS_A relationship. One class can extend another class by using 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. Most importantly, you discover how to unify classes with interfaces to produce clearer application code with improved flexibility.
Get C# 10.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.